Read a local variable / http variable from config file in C [dev]

breaks nginx-forum at nginx.us
Mon Aug 30 20:30:42 MSD 2010


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




More information about the nginx mailing list