I have an nginx config that varies from prod to dev. I'm currently using map
to tease out the differences based on $host
and $server_name
, but the one thing I can't seem to make variable is the resolver. As it stands, I have to set ${RESOLVER}
and replace it during runtime with envsubst
like so:
CMD /bin/bash -c "envsubst '\$RESOLVER' < /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf && cat /etc/nginx/conf.d/default.conf && nginx -g 'daemon off;'"
with a config file (snippet) like
location /auth_website {
internal;
${RESOLVER}
set $backend_upstream "http://$upstream_host/blah/$uuid";
proxy_pass $backend_upstream;
include 'includes/common_auth.conf';
}
is there a way to set a resolver dynamically, based on the $host
, $server_name
or an env var within the file? It feels like no, but I thought I'd ask.