Opened 11 years ago

Last modified 3 years ago

#267 new enhancement

Introduce static variables

Reported by: Johan Bergström Owned by:
Priority: minor Milestone:
Component: nginx-core Version:
Keywords: config static Cc:
uname -a: irrelevant
nginx -V: irrelevant


A very common scenario is checking in config files in whatever VCS/DVCS you have available. Most people doing this also check in things like ip addresses or passwords just to have their deploy scripts push them to servers. This is non-optimal, since it changes more often than not. Alternatives to this is either to pre-process your config scripts (defining your own variable scheme) or use set from the rewrite module. As much as I'd like to use the latter, knowing that it is evaluated on every request, it's very hard to swallow.

With this said, I'd like to see a 'static' variable introduced which would be evaluated when parsing the config. The suggested scenario would be to include a variables.conf in whatever config scope needed, that replaces $variable with value set in variable.conf. Syntax for doing this is somewhat irrelevant, but set foo bar; is generally accepted within the rewrite module. Whatever improvements (or avoiding conflicts) to naming is appreciated.

Hopefully, more people than me would appreciate such a feature to nginx core.

Change History (1)

comment:1 by Maxim Dounin, 3 years ago

Note: See TracTickets for help on using tickets.