全局配置中定义env
events{
...
}
env BPM_SERVICE_HOST;
env BPM_SERVICE_PORT;
service中获取
set_by_lua $bpm_host 'return os.getenv("BPM_SERVICE_HOST")';
set_by_lua $bpm_port 'return os.getenv("BPM_SERVICE_PORT")';
lua中使用
local host=ngx.var.bpm_host
events{
...
}
env BPM_SERVICE_HOST;
env BPM_SERVICE_PORT;
set_by_lua $bpm_host 'return os.getenv("BPM_SERVICE_HOST")';
set_by_lua $bpm_port 'return os.getenv("BPM_SERVICE_PORT")';
local host=ngx.var.bpm_host