OpenResty::Config - Configure file reader for OpenResty
use OpenResty::Config; OpenResty::Config->init; print $OpenResty::Config{'foo.bar'}; # read the config option's value
This module reads the configure settings from the config files.
The OpenResty server usually loads two config files, i.e., openresty.conf and site_openresty.conf.
The config files use the synatx similar to .ini files native to Win32 systems. The underlying file reader is actually Config::Simple.
The steps of determining the paths searched for these two config files and the merging algorithm of these two files' settings are given below:
Look for the config file $FindBin::Bin/../etc/openresty.conf. If it does not exist or is not a file, it tries to look for /etc/openresty/openresty.conf.
Loads the config settings in the config file determined in step 1 to a hash, say, Hash A.
If you set the option -f, the openresty will load the config file you set,
or the openresty will look for the config file
$FindBin::Bin/../etc/site_openresty.conf. If it does not exist or
is not a file, it tries to look for /etc/openresty/site_openresty.conf.
Loads the config settings in the config file determined in step 3 to a hash, say, Hash B.
Merge Hash A obtained in step 2 and Hash B in step 4 using Hash::Merge. The settings in site_openresty.conf takes the priority over the same setting in openresty.conf.
If an option setting is completely missing in site_openresty.conf, then the setting for the same option in openresty.conf (if any) will be used. Note, however, fall-back won't happen when site_openresty has an option with an empty string value, as in
[frontend] ... filtered=
So in order to use the frontend.filtered setting in the openresty.conf file, one has to remove the whole line altegether or just comment it out like this:
frontend.filtered
[frontend] ... #filtered=
Agent Zhang (agentzh) <agentzh@yahoo.cn.
<agentzh@yahoo.cn
OpenResty::Limits, OpenResty.
To install OpenResty, copy and paste the appropriate command in to your terminal.
cpanm
cpanm OpenResty
CPAN shell
perl -MCPAN -e shell install OpenResty
For more information on module installation, please visit the detailed CPAN module installation guide.