Is there a wait to get at a module's main conf inside the loc conf's init?
ptcell
nginx-forum at forum.nginx.org
Thu Aug 17 06:34:20 UTC 2017
Maxim Dounin Wrote:
-------------------------------------------------------
>
> Try ngx_http_conf_get_module_main_conf().
>
> (Doing so in the create_loc_conf callback is probably pointless
> though, as main conf contents can be changed later.)
>
> --
> Maxim Dounin
> http://nginx.org/
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
On a related note, is there a way to get the my module's main/srv/loc conf_t
instances from the cycle instance passed to the worker process init callback
in my module? I see my conf objects created and put into the ctx object
before the worker process init is called, so I think there there.
>From reading the code, I tried something like:
#define ngx_http_cycle_get_module_main_conf(cf, module)
\
((ngx_http_conf_ctx_t *)
(cycle)->conf_ctx)->main_conf[(module).ctx_index]
/* declared as init process in ngx_module_t */
static ngx_int_t ngx_my_init_worker_process(ngx_cycle_t *cycle) {
ngx_http_my_module_conf_t *main_conf;
main_conf = ngx_http_cycle_get_module_main_conf(cycle,
ngx_http_my_module);
}
but that either just returned Nulls or crashed. I suspect there's a
simpler way.
Thank you very much!
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,275998,276080#msg-276080
More information about the nginx
mailing list