Switched to Parse::PlainConfig for parsing config files.
This commit is contained in:
parent
126d36e4ae
commit
deedf4f8eb
1 changed files with 6 additions and 24 deletions
|
|
@ -16,10 +16,10 @@ package WebGUI::Session;
|
||||||
|
|
||||||
|
|
||||||
use CGI;
|
use CGI;
|
||||||
use Data::Config;
|
|
||||||
use Date::Calc;
|
use Date::Calc;
|
||||||
use DBI;
|
use DBI;
|
||||||
use Exporter;
|
use Exporter;
|
||||||
|
use Parse::PlainConfig;
|
||||||
use strict;
|
use strict;
|
||||||
use Tie::CPHash;
|
use Tie::CPHash;
|
||||||
use WebGUI::ErrorHandler;
|
use WebGUI::ErrorHandler;
|
||||||
|
|
@ -391,30 +391,12 @@ sub open {
|
||||||
### config variables
|
### config variables
|
||||||
$session{config}{webguiRoot} = $_[0];
|
$session{config}{webguiRoot} = $_[0];
|
||||||
$session{config}{configFile} = $_[1] || "WebGUI.conf";
|
$session{config}{configFile} = $_[1] || "WebGUI.conf";
|
||||||
|
$config = Parse::PlainConfig->new('DELIM' => '=',
|
||||||
# Below is a patch which allow you to configure WebGUI with
|
'FILE' => $session{config}{webguiRoot}.'/etc/'.$session{config}{configFile},
|
||||||
# environmentvariables in stead of using WebGUI.conf. To enable this
|
'PURGE' => 1);
|
||||||
# set a env var called wgConfigureByEnvironment to 'YES'. The var
|
foreach ($config->directives) {
|
||||||
# names are those of WebGUI.conf prepended with 'wg'.
|
$session{config}{$_} = $config->get($_);
|
||||||
#
|
|
||||||
# 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} ) ) {
|
if( defined( $session{config}{scripturl} ) ) {
|
||||||
# get rid of leading "/" if present.
|
# get rid of leading "/" if present.
|
||||||
$session{config}{scripturl} =~ s/^\///;
|
$session{config}{scripturl} =~ s/^\///;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue