There are 2 self-written nginx modules, a data output module and a module that contains actual data. It is necessary initialize the pointer that is located in the output module from the module that contains the actual data. Initialize this pointer with the address to a variable with actual data (which periodically changes its value), so at the time of data output, dereferencing the pointer, show (output) actual data.
use ngx_http_add_variable to create the "shared" variable, which should return a ngx_http_variable_t which has ngx_http_set_variable_pt and ngx_http_get_variable_pt function pointer to set a value.
The second module should use ngx_http_get_variable to retreive the variable and use the respective ngx_http_set_variable_pt and ngx_http_get_variable_pt
please refer to the njs sources at the following position for adding a variable and for getting a variable for examples
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With