Conversation
|
This is a really useful addition. But I'd like to suggest to make one step further and implement configuration trait for arbitrary core module similar to |
|
Sure thing @ensh63 , I'll follow up next week with CoreModuleConf |
|
Updated with CoreModuleMainConf, made NgxCoreModule a concrete implementation of it. Cleaned out the lingering public accessors from testing. |
| } | ||
|
|
||
| /// Auxiliary structure to access `ngx_core_module` configuration. | ||
| pub struct NgxCoreModule; |
There was a problem hiding this comment.
I think we may expect a special trait for core module, similar to HttpModule trait. To make this PR minimal, I'd suggest to include only module() method to it for now. In future this will allow to add all other necessary components to this trait.
Add core main-conf wrapper for accessing top-level core main
configuration in ngx-rust.
This introduces:
The new API mirrors the existing HTTP config helper style while
centralizing the unsafe conf_ctx slot traversal in one place.
Why:
Modules that need core process configuration currently have to manually
walk cycle->conf_ctx, index with ngx_core_module.index, and cast to
ngx_core_conf_t. That is repetitive, easy to get wrong, and noisy in
reviews.
The immediate use case is the nginx-wasm issue where module
code needs access to core config such as the env state.
Ref: https://github.com/nginx/nginx-wasm/issues/37