Managing IP addresses and ports effectively
As your production configuration grows, it may become more difficult to manage a large number of IP addresses and ports.
As such, it is often helpful to have them defined in their own section.
In 07-security-ports.cfg
, we have:
[buildout] extends = 07-security-localhost.cfg [hosts] localhost = 127.0.0.1 [ports] instance1 = 8081 instance2 = 8082
Notice that we are not using these definitions for anything yet. But we can use them like this:
${hosts:localhost}:${ports:instance1} ${hosts:localhost}:${ports:instance2}
Effectively from now on, we have to change IP addresses and port numbers only in one place (assuming we change all static references such as 127.0.0.1:8080
to the new syntax).