adding configure-by-env support
This commit is contained in:
parent
3764a80551
commit
d70e3064b7
1 changed files with 24 additions and 4 deletions
|
|
@ -236,10 +236,30 @@ sub open {
|
|||
### config variables
|
||||
$session{config}{webguiRoot} = $_[0];
|
||||
$session{config}{configFile} = $_[1] || "WebGUI.conf";
|
||||
$config = new Data::Config $session{config}{webguiRoot}.'/etc/'.$session{config}{configFile};
|
||||
foreach ($config->param) {
|
||||
$session{config}{$_} = $config->param($_);
|
||||
}
|
||||
|
||||
# Below is a patch which allow you to configure WebGUI with
|
||||
# environmentvariables in stead of using WebGUI.conf. To enable this
|
||||
# set a env var called wgConfigureByEnvironment to 'YES'. The var
|
||||
# names are those of WebGUI.conf prepended with 'wg'.
|
||||
#
|
||||
# NOTE: This is an undocumented an experimental feature. It seems to
|
||||
# work with apache/linux on multiple virtual hosts. For things like
|
||||
# runHourly.pm you STILL need WebGUI.conf!
|
||||
|
||||
if ($ENV{wgConfigureByEnvironment} eq 'YES') {
|
||||
foreach (keys(%ENV)) {
|
||||
if ($_ =~ /^wg(.+)$/) {
|
||||
$session{config}{$1} = $ENV{'wg'.$1};
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$config = new Data::Config
|
||||
$session{config}{webguiRoot}.'/etc/'.$session{config}{configFile};
|
||||
foreach ($config->param) {
|
||||
$session{config}{$_} = $config->param($_);
|
||||
}
|
||||
}
|
||||
|
||||
if( defined( $session{config}{scripturl} ) ) {
|
||||
# get rid of leading "/" if present.
|
||||
$session{config}{scripturl} =~ s/^\///;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue