Fix loading of alternate config file (#608)
This commit is contained in:
parent
a724dc783f
commit
e628c703f5
@ -15,7 +15,7 @@ use Regexp::Assemble;
|
|||||||
*EXPORT_TAGS = *Lemonldap::NG::Portal::Simple::EXPORT_TAGS;
|
*EXPORT_TAGS = *Lemonldap::NG::Portal::Simple::EXPORT_TAGS;
|
||||||
*EXPORT = *Lemonldap::NG::Portal::Simple::EXPORT;
|
*EXPORT = *Lemonldap::NG::Portal::Simple::EXPORT;
|
||||||
|
|
||||||
our $VERSION = '1.2.2';
|
our $VERSION = '1.3.0';
|
||||||
use base qw(Lemonldap::NG::Portal::Simple);
|
use base qw(Lemonldap::NG::Portal::Simple);
|
||||||
our $confCached;
|
our $confCached;
|
||||||
|
|
||||||
@ -44,6 +44,10 @@ sub getConf {
|
|||||||
%args = @_;
|
%args = @_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( defined( $args{configStorage} ) ) {
|
||||||
|
$self->{configStorage} = $args{configStorage};
|
||||||
|
}
|
||||||
|
|
||||||
my $num = $self->__lmConf->lastCfg;
|
my $num = $self->__lmConf->lastCfg;
|
||||||
|
|
||||||
# Reload configuration
|
# Reload configuration
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
# change 'tests => 1' to 'tests => last_test_to_print';
|
# change 'tests => 1' to 'tests => last_test_to_print';
|
||||||
|
|
||||||
use Test::More tests => 1;
|
use Test::More tests => 2;
|
||||||
BEGIN { use_ok('Lemonldap::NG::Portal::SharedConf') }
|
BEGIN { use_ok('Lemonldap::NG::Portal::SharedConf') }
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
@ -13,3 +13,48 @@ BEGIN { use_ok('Lemonldap::NG::Portal::SharedConf') }
|
|||||||
# Insert your test code below, the Test::More module is use()ed here so read
|
# Insert your test code below, the Test::More module is use()ed here so read
|
||||||
# its man page ( perldoc Test::More ) for help writing this test script.
|
# its man page ( perldoc Test::More ) for help writing this test script.
|
||||||
|
|
||||||
|
# Try to load an alternate conffile
|
||||||
|
use File::Temp;
|
||||||
|
my $dir = File::Temp->newdir();
|
||||||
|
my $ini = File::Temp->new( DIR => $dir );
|
||||||
|
|
||||||
|
print $ini "[all]
|
||||||
|
|
||||||
|
[configuration]
|
||||||
|
type=File
|
||||||
|
dirName=$dir
|
||||||
|
|
||||||
|
[portal]
|
||||||
|
portalSkin = test
|
||||||
|
";
|
||||||
|
|
||||||
|
$ini->flush();
|
||||||
|
|
||||||
|
open( CONF, ">$dir/lmConf-1" ) or die $@;
|
||||||
|
|
||||||
|
print CONF "
|
||||||
|
cfgNum
|
||||||
|
1
|
||||||
|
|
||||||
|
useXForwardedForIP
|
||||||
|
0
|
||||||
|
|
||||||
|
key
|
||||||
|
tmp
|
||||||
|
|
||||||
|
";
|
||||||
|
|
||||||
|
CONF->flush();
|
||||||
|
|
||||||
|
my $portal = Lemonldap::NG::Portal::SharedConf->new(
|
||||||
|
{
|
||||||
|
globalStorage => 'Apache::Session::File',
|
||||||
|
domain => 'example.com',
|
||||||
|
configStorage => { confFile => "$ini" },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
my $test = $portal->{portalSkin};
|
||||||
|
|
||||||
|
ok( $test eq "test", "Custom INI file" );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user