Want to access UNIX environment variable

Jonathan Matthews contact at jpluscplusm.com
Thu Feb 28 10:54:16 UTC 2013


On 28 February 2013 06:04, amodpandey <nginx-forum at nginx.us> wrote:
> Let me put what I want to achieve.
>
> Before that I want to know what is this 'env' global directive for?

I don't know. The documentation suggests it's not going to solve the
problem you want; but I've not used it.

> I want to maintain a single set of configuration files for dev and prod. The
> machines would have environment variable set ENV=dev or ENV=prod. Based on
> the values of the ENV varibale I wanted to pick my upstream conf, either
> upstream_dev.conf or upstream_prod.conf through 'include
> upstream_$ENV.conf'.
>
> Please suggest an approach.

Use something that helps you template your config files. Chef, puppet,
Erb, Perl, bash - whatever works for you.

[ However, I will suggest that rolling your own templating setup is a
strong indicator of an inexperienced sysadmin; one who doesn't yet
understand the value of consistency, the principle of least surprise,
and why NIH is a Bad Thing. ]

HTH,
Jonathan
-- 
Jonathan Matthews // Oxford, London, UK
http://www.jpluscplusm.com/contact.html



More information about the nginx mailing list