docker-archive / dockercloud-haproxy

HAproxy image that autoreconfigures itself when used in Docker Cloud
https://cloud.docker.com/
651 stars 187 forks source link

Add support for prefix in services environment variables #224

Open blop opened 6 years ago

blop commented 6 years ago

Currently all the environment variables that needs to be set on the application services are NOT prefixed. This could cause some collision with some other configurations.

For example, you specify we need to use the generic "OPTION" environment variable to set custom options.

I'd suggest to add something like SERVICE_ENV_PREFIX (or some other name), which could be empty by default to ensure backward compatiblity.

This way one could set SERVICE_ENVPREFIX="HAPROXY" on the dockercloud/haproxy service, and then set backend configuration using prefixed environment variables like HAPROXY_VIRTUAL_HOST instead of VIRTUAL_HOST.