Env variables in config


is something like this possible? actually the env variable is existent but it does not get picked up

image image

As far as I know, this is currently not possible. The Foreman itself uses ERB on top of its YAML files which would allow this, but the Foreman Proxy doesn’t. We are discussing this, but it’s very early. It would help us to decide on an implementation if you could describe the use case.

we run everything in containers because everything should run in openshift so every piece of software needs to be a container.

i’m building a foreman container where i want to use different environment variables for different environments like integration, testing, development and production

it would be nice to be able to use env variables in foreman // foreman-proxy config because the way i have to go now is to sedidate everything like this in entrypoint, so my config gets written based on substituted environment vars on container startup:

if [  -n "${DNS_ENABLED+x}" ]; then
    echo " ---> settings: server enabled = ${DNS_ENABLED}" && \
    bash -c "sed -i 's/:enabled:.*$/:enabled: $DNS_ENABLED/' ${F_PROXY_CONFDIR}/${DNS_CONFIG}"
if [  -n "${DNS_PROVIDER+x}" ]; then
    echo " ---> settings: dns provider = ${DNS_PROVIDER}" && \
    sed -i '/:use_provider/s/^#//g' ${F_PROXY_CONFDIR}/${DNS_CONFIG} && \ 
    bash -c "sed -i 's/:use_provider:.*$/:use_provider: $DNS_PROVIDER/' ${F_PROXY_CONFDIR}/${DNS_CONFIG}"
if [  -n "${DNS_TTL+x}" ]; then
    echo " ---> settings: dns TTL = ${DNS_TTL}" && \
    sed -i '/:dns_ttl/s/^#//g' ${F_PROXY_CONFDIR}/${DNS_CONFIG} && \ 
    bash -c "sed -i 's/:dns_ttl:.*$/:dns_ttl: $DNS_TTL/' ${F_PROXY_CONFDIR}/${DNS_CONFIG}"

if the .yml’s would be able to interpret env variables i wouldn’t need this