Openresty reads environment variables

  nginx

Env defined in global configuration

events{
  ...
}

env BPM_SERVICE_HOST;
env BPM_SERVICE_PORT;

Get from 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

doc