全域性配置中定義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