Welcome! Log In Create A New Profile

Advanced

Re: Where to store global settings in filter

Maxim Dounin
August 25, 2014 09:22AM
Hello!

On Mon, Aug 25, 2014 at 10:55:06AM +0800, Jerry OELoo wrote:

> Hi All:
> I have some settings in a json file (not in nginx.conf file),
> Currently, in my module filter function, I will open file, read file,
> close file every time filter function is called.
> I think this is not so good, so I think it's better call a function
> just one time, and save the setting in a global variable, but I do not
> where is a proper position in Nginx module, Thanks!

It may be a good idea to read the json file while parsing
configuration. Such things are usually done either when
processing a directive which specifies a file to use, or in a
configuration merge callback.

E.g., XSLT filter loads stylesheets specified in the
ngx_http_xslt_stylesheet() function, which is called to handle the
"xslt_stylesheet" directive. See
src/http/modules/ngx_http_xslt_filter_module.c for details.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Where to store global settings in filter

Jerry OELoo August 24, 2014 10:56PM

Re: Where to store global settings in filter

Maxim Dounin August 25, 2014 09:22AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 316
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready