7

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.

timsabat
  • 2,208
  • 3
  • 25
  • 34
  • Any update on this? I'm having this problem too and it's surprising that there's no obvious way round it. – Joe Sep 25 '19 at 15:29

0 Answers0