How to iterating all server context in init_module function

Wigunawan Wigunawan lists at ruby-forum.com
Thu Oct 21 20:27:27 MSD 2010


I need a clue for my problem when building my first module:

in nginx.conf i set something like this:

http {
   server {
      listen 80;
      server_name  serverA;
      UploadStoragePath /temp/A;
      #blah etc...
   }
   server {
      listen 80;
      server_name  serverB;
      UploadStoragePath /temp/B;
      #blah etc...
   }
}


i have a server context variable:

typedef struct {
  ngx_path_t *UploadStoragePath;
  ngx_str_t AdminEMailAddress;
} ngx_http_testing_srv_conf_t;


static char *ngx_http_testing_merge_srv_conf(ngx_conf_t *cf, void
*parent, void *child)
{
    // i successfuly set "UploadStoragePath" variable for each server
    // here
}

then, i want to set "AdminEMailAddress" variable in init_module
function:

static ngx_int_t ngx_http_testing_init_module(ngx_cycle_t *cycle)
{
    // problem here
    // how to set "AdminEMailAddress" variable for each server?
    // , something like iterating each server context here
}

please help me.

Regards

-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list