如果你想访问系统环境变量,例如foo
,在Lua中通过标准Lua APIos.getenv,同时你应当在nginx.conf
文件的环境小节中列出环境变量。例如:
env foo;
English source:
If you want to access the system environment variable, say, foo
, in Lua via the standard Lua API os.getenv, then you should also list this environment variable name in your nginx.conf
file via the env directive. For example,
env foo;