Allow the usen of the "env" directive in contexts other than "main"

Maxim Dounin mdounin at
Thu Jan 4 17:06:15 UTC 2018


On Thu, Jan 04, 2018 at 01:22:15AM +0000, German Jaber wrote:

> Is there a reason why the "env" directive is only allowed inside the "main"
> contexts?

The "env" directive controls which environment variables will be 
available in the nginx worker processes.  Environment variables 
apply to the whole worker process, and are not differentiated based on 
what the worker process is doing in the particular time.  As such, 
these directives are to be specified at the global level.

> It would simplify many of my Docker deployments if I could do away with sed
> and envsubst and use the "env" directive directly.
> If the maintainers approve the inclusion of this feature in Nginx, I would
> like to offer my time to this project by implementing this functionality.

Sorry, from your description it is not clear what you are trying 
to do and how the "env" directive can help here.  You may want to 
elaborate on this.

Maxim Dounin

More information about the nginx mailing list