Welcome! Log In Create A New Profile

Advanced

Re: Want to access UNIX environment variable

E. Westbrook
March 07, 2013 04:18AM
Posting a bit late to this thread, but thought I'd contribute. Having
found no better way myself, the way I "import" environment variables
into my nginx configurations is as follows.

At top config level:

env MYVAR;

At http level:

perl_set $myvar 'sub { return $ENV{"MYVAR"}; }';

Then, for example, at server level:

root $myvar;

Works a treat. Obviously there must be an overhead cost with this
approach, but either it's small, or I'm small, because I haven't noticed
it. (And even then, if I found it significant, I'd probably get to work
on a proper patch, since environment variables are rather central to my
general service configuration strategy.)

I'd love to know if anyone does it differently and/or better. If a
helper is how it must be done, I'd actually prefer to use Lua -- but
"perl_set" is documented for use at the http config level, whereas
"lua_set" (for whatever reason) is not.

$0.02,
Eric

On 02/27/2013 11:22 PM, amodpandey wrote:
> Thank you.
>
> I am looking for an simpler ( direct ) approach. For now I have put a sed
> script in my bounce nginx which does that.
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,236654,236706#msg-236706
>
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Want to access UNIX environment variable

amodpandey February 27, 2013 01:49AM

Re: Want to access UNIX environment variable

Jonathan Matthews February 27, 2013 05:52AM

Re: Want to access UNIX environment variable

amodpandey February 28, 2013 01:04AM

Re: Want to access UNIX environment variable

kalpesh.patel@glgroup.com March 11, 2013 05:39PM

Re: Want to access UNIX environment variable

kalpesh.patel@glgroup.com March 11, 2013 05:41PM

Re: Want to access UNIX environment variable

Zachary Stern February 28, 2013 01:16AM

Re: Want to access UNIX environment variable

amodpandey February 28, 2013 01:22AM

Re: Want to access UNIX environment variable

E. Westbrook March 07, 2013 04:18AM

Re: Want to access UNIX environment variable

Jonathan Matthews February 28, 2013 05:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 138
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready