very simple question for most of you I suppose, but I can't find any answers. I don't know lua at all, I just need this for work :)
I have a line in my nginx.conf like so:
set_by_lua_file $instance_address conf/some_file.lua "user:";
What I need to do basically is set my variable instance_address
from my file some_file.lua
and also passing the variable user:*
for this example. Does this work ? Can I access the variable inside some_file.lua
then ? How ?
I've tried with $0
, $1
, arg[0]
and arg[1]
but it didn't work
Cheers !
CodePudding user response:
If you want to pass some value to the lua script from nginx configuration, you can set some variable to the required value, e.g.
set $user "user:";
and then use it in the lua script via ngx.var.user
.