Forum: NGINX Read a local variable / http variable from config file in C

Posted by breaks (Guest)
on 2010-08-30 18:32
(Received via mailing list)
Hello,

I write a new module to nginx, and I have a small problem, because I
don't know how I can read local/http variable (for example from GeoIP
module) from nginx configuration file in my module. Below is a piece of
my code :

my_module.c
-
{ ngx_string("my_language"),

NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_HTTP_SIF_CONF|NGX_CONF_TAKE1,
      ngx_conf_set_str_slot,
      NGX_HTTP_LOC_CONF_OFFSET,
      offsetof(ngx_http_my_loc_conf_t, language),
      NULL },
-

nginx.conf
-
...
geoip_country_file /usr/local/nginx/GeoIP.dat;
...
my_language $geoip_country_code;
...
-

But in the variable language in ngx_http_my_loc_conf_t struct, I have
string not parsed "$geoip_country_code" not a "US". GeoIP module works,
I checked.

Please for any suggestions,
Thanks in advance.
-

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,125270,125270#msg-125270
Posted by michalkraus (Guest)
on 2010-12-17 12:04
(Received via mailing list)
Hello,
I have the same problem. How can I get the value of a variable from
nginx.conf?

Thanks, Michal

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,125270,159360#msg-159360
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.