Changes between Version 1 and Version 2 of Ticket #1785, comment 1


Ignore:
Timestamp:
06/19/20 07:24:38 (4 years ago)
Author:
edrandall@…

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1785, comment 1

    v1 v2  
    55Sometimes (this is just one example, there are other use cases) rewrites to environment-specific services are required, eg. dev must proxy for "service-X-dev" in dev, test for "service-X-tst" in test, and so forth - "service-X" might not even be in kubernetes yet.  If our nginx config could read environment values, this can become straightforward and easy to understand.
    66
    7 I'm not saying there aren't other solutions to the above, but ability to configure map{...} output or variable value on the basis of an env variable can make this a lot easier.  We don't really want to have pre-launch init script which reads the environment and generates a fragment of Nginx config file from it, it's a hacky solution.
     7I'm not saying there aren't other solutions to the above, but ability to configure map{...} output or variable value on the basis of an env variable can make this a lot easier.  We don't really want to have pre-launch init script which reads the environment and generates a fragment of Nginx config file from it, it's a hacky solution and as the OP states, requires writing to the image filesystem.
    88
    99We can't use the Lua module for info-security reasons - the whole point of choosing Nginx is for a small attack surface with minimal additional modules.
    1010
    11 A directive something like this, in global context{...} scope, would probably suffice:
     11A directive something like this, probably in outermost context{...} scope, would likely suffice:
    1212{{{
    1313$variable = getenv('NAME', 'DEFAULT_VALUE');
    1414}}}
     15This would then only get evaluated once when first used after startup and be available therafter in all child scopes.