dubstep
September 15, 2011, 11:04pm
1
Hi there,
After set a variable by set $name value, i can reference it like
$name,
but when i export a OS Environment Variale by env name_from_env, like
Core functionality said,
and i am sure the name_from_env is valid which defined form nginx’s
parent process.
But, my friends, how to reference it ?
$name_from_env or ${name_from_env} or %name_from_env% didn’t work what
i’ve tried before.
Thanks a lot.
Posted at Nginx Forum:
Hi there, After set a variable by `set $name value`, i can reference it like `$name`, but when i export a OS Environment Variale by `env name_from_env`, like http://wiki.nginx.org/CoreModule#env said, and i am sure the name_from_env is valid which...
On Fri, Sep 16, 2011 at 5:03 AM, caoxingk [email protected] wrote:
After set a variable by set $name value, i can reference it like
$name,
but when i export a OS Environment Variale by env name_from_env, like
GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub said,
and i am sure the name_from_env is valid which defined form nginx’s
parent process.
But, my friends, how to reference it ?
You can read system environment variables with ngx_lua enabled in your
nginx build: GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub
env PATH;
http {
...
server {
location /path {
set_by_lua $path 'return os.getenv("PATH")';
...
}
}
BTW, to use the set_by_lua directive, you also need to enable the
ngx_devel_kit module here: GitHub - vision5/ngx_devel_kit: Nginx Development Kit - an Nginx module that adds additional generic tools that module developers can use in their own modules · GitHub
(it’ll be easier if you use the ngx_openresty bundle).
Regards,
-agentzh