Merge storage.conf and localconf.ini in lemonldap-ng.ini
This commit is contained in:
parent
acbc7a677c
commit
0ea44c2389
|
@ -55,7 +55,8 @@ CONFDIR=$(LMPREFIX)/etc
|
||||||
RCONFDIR=$(DESTDIR)/$(CONFDIR)
|
RCONFDIR=$(DESTDIR)/$(CONFDIR)
|
||||||
CRONDIR=$(LMPREFIX)/etc/cron.d
|
CRONDIR=$(LMPREFIX)/etc/cron.d
|
||||||
RCRONDIR=$(DESTDIR)/$(CRONDIR)
|
RCRONDIR=$(DESTDIR)/$(CRONDIR)
|
||||||
STORAGECONFFILE=$(CONFDIR)/storage.conf
|
CONFFILENAME=lemonldap-ng.ini
|
||||||
|
STORAGECONFFILE=$(CONFDIR)/$(CONFFILENAME)
|
||||||
|
|
||||||
# Lemonldap-ng configuration storage dir
|
# Lemonldap-ng configuration storage dir
|
||||||
FILECONFIGDIR=$(DATADIR)/conf
|
FILECONFIGDIR=$(DATADIR)/conf
|
||||||
|
@ -366,9 +367,8 @@ install_conf_dir: install_sessions_dir
|
||||||
# Configuration files install
|
# Configuration files install
|
||||||
@install -v -d $(RCONFDIR) $(RFILECONFIGDIR) $(RTOOLSDIR)
|
@install -v -d $(RCONFDIR) $(RFILECONFIGDIR) $(RTOOLSDIR)
|
||||||
@if [ "$(ERASECONFIG)" -eq "1" ]; then \
|
@if [ "$(ERASECONFIG)" -eq "1" ]; then \
|
||||||
cp --remove-destination $(SRCCOMMONDIR)/storage.conf $(RCONFDIR); \
|
cp --remove-destination $(SRCCOMMONDIR)/$(CONFFILENAME) $(RCONFDIR); \
|
||||||
perl -i -pe 's#^dirName = .*#dirName = $(FILECONFIGDIR)#g' $(RCONFDIR)/storage.conf; \
|
perl -i -pe 's#^dirName\s*=\s*.*#dirName = $(FILECONFIGDIR)#g' $(RCONFDIR)/$(CONFFILENAME); \
|
||||||
cp --remove-destination $(SRCCOMMONDIR)/localconf.ini $(RCONFDIR); \
|
|
||||||
fi
|
fi
|
||||||
@cp _example/conf/lmConf-1 $(RFILECONFIGDIR)
|
@cp _example/conf/lmConf-1 $(RFILECONFIGDIR)
|
||||||
@perl -000 -i -pe "s#^(globalStorageOptions\\n\\s+)'[^\\n]*?'\$$#\$${1}\'\\\$$data1 = {&39;Directory&39; => &39;$(APACHESESSIONFILEDIR)&39;,&39;LockDirectory&39; => &39;$(APACHESESSIONFILELOCKDIR)&39;};'#m" $(RFILECONFIGDIR)/lmConf-1
|
@perl -000 -i -pe "s#^(globalStorageOptions\\n\\s+)'[^\\n]*?'\$$#\$${1}\'\\\$$data1 = {&39;Directory&39; => &39;$(APACHESESSIONFILEDIR)&39;,&39;LockDirectory&39; => &39;$(APACHESESSIONFILELOCKDIR)&39;};'#m" $(RFILECONFIGDIR)/lmConf-1
|
||||||
|
|
|
@ -22,7 +22,7 @@ META.yml Module meta-data (added by MakeMaker)
|
||||||
README
|
README
|
||||||
scripts/lmConfig_File2LDIF
|
scripts/lmConfig_File2LDIF
|
||||||
scripts/lmConfig_File2MySQL
|
scripts/lmConfig_File2MySQL
|
||||||
storage.conf
|
lemonldap-ng.ini
|
||||||
t/01-Common-Conf.t
|
t/01-Common-Conf.t
|
||||||
t/02-Common-Conf-File.t
|
t/02-Common-Conf-File.t
|
||||||
t/03-Common-Conf-DBI.t
|
t/03-Common-Conf-DBI.t
|
||||||
|
|
|
@ -20,7 +20,6 @@ requires:
|
||||||
Regexp::Assemble: 0
|
Regexp::Assemble: 0
|
||||||
SOAP::Lite: 0
|
SOAP::Lite: 0
|
||||||
Storable: 0
|
Storable: 0
|
||||||
File::Basename: 0
|
|
||||||
Config::IniFiles: 0
|
Config::IniFiles: 0
|
||||||
no_index:
|
no_index:
|
||||||
directory:
|
directory:
|
||||||
|
|
|
@ -12,7 +12,7 @@ sub MY::top_targets {
|
||||||
$r .= <<"EOT";
|
$r .= <<"EOT";
|
||||||
|
|
||||||
my_target:
|
my_target:
|
||||||
perl -i -pe 's/^(use constant DEFAULTCONFFILE =>).*\$\$/\$\$1 "$cf";/' blib/lib/Lemonldap/NG/Common/Conf.pm
|
perl -i -pe 's/^(use constant DEFAULTCONFFILE\\s*=>).*\$\$/\$\$1 "$cf";/' blib/lib/Lemonldap/NG/Common/Conf/Constants.pm
|
||||||
EOT
|
EOT
|
||||||
}
|
}
|
||||||
return $r;
|
return $r;
|
||||||
|
@ -32,6 +32,7 @@ WriteMakefile(
|
||||||
'SOAP::Lite' => 0,
|
'SOAP::Lite' => 0,
|
||||||
'Crypt::Rijndael' => 0,
|
'Crypt::Rijndael' => 0,
|
||||||
'HTTP::Headers' => 0,
|
'HTTP::Headers' => 0,
|
||||||
|
'Config::IniFiles' => 0,
|
||||||
}, # e.g., Module::Name => 1.1
|
}, # e.g., Module::Name => 1.1
|
||||||
#EXE_FILES => [ 'scripts/lmConfig_File2MySQL', ],
|
#EXE_FILES => [ 'scripts/lmConfig_File2MySQL', ],
|
||||||
(
|
(
|
||||||
|
|
|
@ -6,11 +6,21 @@
|
||||||
# local LemonLDAP::NG elements
|
# local LemonLDAP::NG elements
|
||||||
#
|
#
|
||||||
# Parameters of section "all" are always read
|
# Parameters of section "all" are always read
|
||||||
|
# Section "configuration" is used to load global configuration and set cache
|
||||||
# Other section are only read by the specific LemonLDAP::NG component
|
# Other section are only read by the specific LemonLDAP::NG component
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
|
||||||
[all]
|
[all]
|
||||||
#cda = 1
|
;cda = 1
|
||||||
|
|
||||||
|
[configuration]
|
||||||
|
# Global configuration access type (File, SOAP, DBI, LDAP)
|
||||||
|
type = File
|
||||||
|
dirName = /var/lib/lemonldap-ng/conf
|
||||||
|
|
||||||
|
# Configuration cache
|
||||||
|
localStorage = Cache::FileCache
|
||||||
|
localStorageOptions = { 'namespace' => 'MyNamespace', 'default_expires_in' => 600, 'directory_umask' => '007', 'cache_root' => '/tmp', 'cache_depth' => 5, }
|
||||||
|
|
||||||
[portal]
|
[portal]
|
||||||
portalDisplayResetPassword = 0
|
portalDisplayResetPassword = 0
|
||||||
|
@ -20,5 +30,5 @@ https = 0
|
||||||
|
|
||||||
[manager]
|
[manager]
|
||||||
dhtmlXTreeImageLocation = /imgs/
|
dhtmlXTreeImageLocation = /imgs/
|
||||||
#protection = authenticate
|
;protection = authenticate
|
||||||
|
|
|
@ -12,7 +12,6 @@ no strict 'refs';
|
||||||
use Lemonldap::NG::Common::Conf::Constants; #inherits
|
use Lemonldap::NG::Common::Conf::Constants; #inherits
|
||||||
use Lemonldap::NG::Common::Crypto; #link protected cipher Object "cypher" in configuration hash
|
use Lemonldap::NG::Common::Crypto; #link protected cipher Object "cypher" in configuration hash
|
||||||
use Regexp::Assemble;
|
use Regexp::Assemble;
|
||||||
use File::Basename;
|
|
||||||
use Config::IniFiles;
|
use Config::IniFiles;
|
||||||
|
|
||||||
#inherits Lemonldap::NG::Common::Conf::File
|
#inherits Lemonldap::NG::Common::Conf::File
|
||||||
|
@ -20,15 +19,9 @@ use Config::IniFiles;
|
||||||
#inherits Lemonldap::NG::Common::Conf::SOAP
|
#inherits Lemonldap::NG::Common::Conf::SOAP
|
||||||
#inherits Lemonldap::NG::Common::Conf::LDAP
|
#inherits Lemonldap::NG::Common::Conf::LDAP
|
||||||
|
|
||||||
use constant DEFAULTCONFFILE => "/usr/local/lemonldap-ng/etc/storage.conf";
|
|
||||||
use constant LOCALCONFFILENAME => "localconf.ini";
|
|
||||||
use constant DEFAULTINISECTION => "all";
|
|
||||||
|
|
||||||
our $VERSION = 0.70;
|
our $VERSION = 0.70;
|
||||||
our $msg;
|
our $msg;
|
||||||
|
|
||||||
our %_confFiles;
|
|
||||||
|
|
||||||
## @cmethod Lemonldap::NG::Common::Conf new(hashRef arg)
|
## @cmethod Lemonldap::NG::Common::Conf new(hashRef arg)
|
||||||
# Constructor.
|
# Constructor.
|
||||||
# Succeed if it has found a way to access to Lemonldap::NG configuration with
|
# Succeed if it has found a way to access to Lemonldap::NG configuration with
|
||||||
|
@ -53,12 +46,18 @@ sub new {
|
||||||
%$self = %{ $_[0] };
|
%$self = %{ $_[0] };
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (defined @_ and ($#_>0) ) {
|
if ( defined @_ && $#_%2 == 1 ) {
|
||||||
%$self = @_;
|
%$self = @_;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unless ( $self->{mdone} ) {
|
unless ( $self->{mdone} ) {
|
||||||
$self->_readConfFile( $self->{confFile} ) unless ( $self->{type} );
|
unless ( $self->{type} ) {
|
||||||
|
# Use local conf to get configStorage and localStorage
|
||||||
|
my $localconf = $self->getLocalConf( CONFSECTION, $self->{confFile}, 0 );
|
||||||
|
if ( defined $localconf ) {
|
||||||
|
%$self = ( %$self, %$localconf );
|
||||||
|
}
|
||||||
|
}
|
||||||
unless ( $self->{type} ) {
|
unless ( $self->{type} ) {
|
||||||
$msg .= 'Error: configStorage: type is not defined';
|
$msg .= 'Error: configStorage: type is not defined';
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -90,39 +89,6 @@ sub new {
|
||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
## @method private boolean _readConfFile(string file)
|
|
||||||
# Read $file to know how to access to Lemonldap::NG configuration.
|
|
||||||
# @param $file Optional file name (default: /etc/lemonldap-ng/storage.conf)
|
|
||||||
# @return True if the file was successfuly read
|
|
||||||
sub _readConfFile {
|
|
||||||
my $self = shift;
|
|
||||||
my $file = shift || DEFAULTCONFFILE;
|
|
||||||
unless ( $_confFiles{$file} ) {
|
|
||||||
unless ( open F, $file ) {
|
|
||||||
$msg = "Warning $file: $!. ";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
while (<F>) {
|
|
||||||
next if ( /^\s*$/ or /^\s*#/ );
|
|
||||||
chomp;
|
|
||||||
s/\r//g;
|
|
||||||
/^\s*([\w]+)(?:\s*[:=]\s*|\s+)(["']?)([\S].*[\S])\2\s*$/ or next;
|
|
||||||
my $k = $1;
|
|
||||||
$_confFiles{$file}->{$k} = $3;
|
|
||||||
if ( $_confFiles{$file}->{$k} =~ /^[{\[].*[}\]]$/ ) {
|
|
||||||
eval "\$_confFiles{'$file'}->{'$k'} = $_confFiles{$file}->{$k}";
|
|
||||||
if ($@) {
|
|
||||||
$msg = "Warning: error in file $file : $@. ";
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
close F;
|
|
||||||
}
|
|
||||||
%$self = ( %$self, %{ $_confFiles{$file} } );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
## @method int saveConf(hashRef conf)
|
## @method int saveConf(hashRef conf)
|
||||||
# Serialize $conf and call store().
|
# Serialize $conf and call store().
|
||||||
# @param $conf Lemonldap::NG configuration hashRef
|
# @param $conf Lemonldap::NG configuration hashRef
|
||||||
|
@ -195,26 +161,29 @@ sub getConf {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
## @method hashRef getLocalConf(string section, string file)
|
## @method hashRef getLocalConf(string section, string file, int loaddefault)
|
||||||
# Get configuration from local file
|
# Get configuration from local file
|
||||||
#
|
#
|
||||||
# @param $section Optional section name (default DEFAULTINISECTION)
|
# @param $section Optional section name (default DEFAULTSECTION)
|
||||||
# @param $file Optional file name (default dirname DEFAULTCONFFILE . LOCALCONFFILENAME)
|
# @param $file Optional file name (default DEFAULTCONFFILE)
|
||||||
|
# @param $loaddefault Optional load default section parameters (default 1)
|
||||||
# @return Lemonldap::NG configuration
|
# @return Lemonldap::NG configuration
|
||||||
sub getLocalConf {
|
sub getLocalConf {
|
||||||
my ( $self, $section, $file ) = @_;
|
my ( $self, $section, $file, $loaddefault ) = @_;
|
||||||
my $r;
|
my $r;
|
||||||
|
|
||||||
$section ||= DEFAULTINISECTION;
|
$section ||= DEFAULTSECTION;
|
||||||
|
$file ||= DEFAULTCONFFILE;
|
||||||
|
$loaddefault = 1 unless ( defined $loaddefault );
|
||||||
|
|
||||||
unless ( $file ) {
|
# If default configuration cannot be read
|
||||||
# Get storage.conf path
|
# - Error if configuration section is requested
|
||||||
my( $filename, $directories ) = fileparse DEFAULTCONFFILE;
|
# - Silent exit for other section requests
|
||||||
$file = $directories . LOCALCONFFILENAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
# If local configuration file does not exists, exit silently.
|
|
||||||
unless ( -r $file ) {
|
unless ( -r $file ) {
|
||||||
|
if ( $section eq CONFSECTION) {
|
||||||
|
$msg = "Cannot read $file to get configuration access parameters";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,18 +193,39 @@ sub getLocalConf {
|
||||||
-allowempty => 1,
|
-allowempty => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
unless (defined $cfg) {
|
unless ( defined $cfg ) {
|
||||||
$msg = "Local config error: ".@Config::IniFiles::errors;
|
$msg = "Local config error: ".@Config::IniFiles::errors;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Check if default section exists
|
||||||
|
unless ( $cfg->SectionExists( DEFAULTSECTION ) ) {
|
||||||
|
$msg = "Default section (".DEFAULTSECTION.") is missing";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if configuration section exists
|
||||||
|
if ( $section eq CONFSECTION and !$cfg->SectionExists( CONFSECTION ) ) {
|
||||||
|
$msg = "Configuration section (".CONFSECTION.") is missing";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
# First load all default section parameters
|
# First load all default section parameters
|
||||||
foreach ($cfg->Parameters( DEFAULTINISECTION )) {
|
if ( $loaddefault ) {
|
||||||
$r->{$_} = $cfg->val( DEFAULTINISECTION, $_ );
|
foreach ($cfg->Parameters( DEFAULTSECTION )) {
|
||||||
|
$r->{$_} = $cfg->val( DEFAULTSECTION, $_ );
|
||||||
|
if ( $r->{$_} =~ /^[{\[].*[}\]]$/ ) {
|
||||||
|
eval "\$r->{$_} = $r->{$_}";
|
||||||
|
if ($@) {
|
||||||
|
$msg = "Warning: error in file $file: $@. ";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Stop if the requested section is the default section
|
# Stop if the requested section is the default section
|
||||||
return $r if ( $section eq DEFAULTINISECTION );
|
return $r if ( $section eq DEFAULTSECTION );
|
||||||
|
|
||||||
# Check if requested section exists
|
# Check if requested section exists
|
||||||
return 0 unless $cfg->SectionExists( $section );
|
return 0 unless $cfg->SectionExists( $section );
|
||||||
|
@ -243,6 +233,13 @@ sub getLocalConf {
|
||||||
# Load section parameters
|
# Load section parameters
|
||||||
foreach ($cfg->Parameters( $section )) {
|
foreach ($cfg->Parameters( $section )) {
|
||||||
$r->{$_} = $cfg->val( $section, $_ );
|
$r->{$_} = $cfg->val( $section, $_ );
|
||||||
|
if ( $r->{$_} =~ /^[{\[].*[}\]]$/ ) {
|
||||||
|
eval "\$r->{$_} = $r->{$_}";
|
||||||
|
if ($@) {
|
||||||
|
$msg = "Warning: error in file $file: $@. ";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $r;
|
return $r;
|
||||||
|
|
|
@ -4,7 +4,7 @@ use strict;
|
||||||
use Exporter 'import';
|
use Exporter 'import';
|
||||||
|
|
||||||
use base qw(Exporter);
|
use base qw(Exporter);
|
||||||
our $VERSION = '0.1';
|
our $VERSION = '0.20';
|
||||||
|
|
||||||
# CONSTANTS
|
# CONSTANTS
|
||||||
|
|
||||||
|
@ -13,6 +13,12 @@ use constant UNKNOWN_ERROR => -2;
|
||||||
use constant DATABASE_LOCKED => -3;
|
use constant DATABASE_LOCKED => -3;
|
||||||
use constant UPLOAD_DENIED => -4;
|
use constant UPLOAD_DENIED => -4;
|
||||||
use constant SYNTAX_ERROR => -5;
|
use constant SYNTAX_ERROR => -5;
|
||||||
|
use constant DEFAULTCONFFILE => "/usr/local/lemonldap-ng/etc/lemonldap-ng.ini";
|
||||||
|
use constant DEFAULTSECTION => "all";
|
||||||
|
use constant CONFSECTION => "configuration";
|
||||||
|
use constant PORTALSECTION => "portal";
|
||||||
|
use constant HANDLERSECTION => "handler";
|
||||||
|
use constant MANAGERSECTION => "manager";
|
||||||
|
|
||||||
our %EXPORT_TAGS = ( 'all' => [ qw(
|
our %EXPORT_TAGS = ( 'all' => [ qw(
|
||||||
CONFIG_WAS_CHANGED
|
CONFIG_WAS_CHANGED
|
||||||
|
@ -20,6 +26,12 @@ our %EXPORT_TAGS = ( 'all' => [ qw(
|
||||||
DATABASE_LOCKED
|
DATABASE_LOCKED
|
||||||
UPLOAD_DENIED
|
UPLOAD_DENIED
|
||||||
SYNTAX_ERROR
|
SYNTAX_ERROR
|
||||||
|
DEFAULTCONFFILE
|
||||||
|
DEFAULTSECTION
|
||||||
|
CONFSECTION
|
||||||
|
PORTALSECTION
|
||||||
|
HANDLERSECTION
|
||||||
|
MANAGERSECTION
|
||||||
) ] );
|
) ] );
|
||||||
|
|
||||||
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
|
||||||
|
|
|
@ -1,52 +0,0 @@
|
||||||
#
|
|
||||||
# This file contains parameters used by Lemonldap::NG to find its configuration
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 1 - Type
|
|
||||||
#
|
|
||||||
# You can use one of the following:
|
|
||||||
# * File: you have to set 'dirName' parameter. Example:
|
|
||||||
#
|
|
||||||
# type = File
|
|
||||||
# dirName = /var/lib/lemonldap-ng/conf
|
|
||||||
#
|
|
||||||
# * DBI : you have to set 'dbiChain' (required) and 'dbiUser' and 'dbiPassword'
|
|
||||||
# if needed. Example:
|
|
||||||
#
|
|
||||||
# type = DBI
|
|
||||||
# dbiChain = DBI:mysql:database=lemonldap-ng;host=1.2.3.4
|
|
||||||
# dbiUser = lemonldap
|
|
||||||
# dbiPassword = password
|
|
||||||
#
|
|
||||||
# * SOAP: SOAP configuration access is a sort of proxy: the portal is
|
|
||||||
# configured to use the real session storage type (DBI or File for
|
|
||||||
# example).
|
|
||||||
# You have to set 'proxy' parameter. Example:
|
|
||||||
#
|
|
||||||
# type = SOAP
|
|
||||||
# proxy = https://auth.example.com/index.pl/config
|
|
||||||
# proxyOptions = { timeout => 5 }
|
|
||||||
# User = lemonldap
|
|
||||||
# Password = mypassword
|
|
||||||
#
|
|
||||||
# * LDAP: you have to set ldapServer, ldapConfBranch, ldapBindDN and ldapBindPassword.
|
|
||||||
#
|
|
||||||
# type = LDAP
|
|
||||||
# ldapServer = ldap://localhost
|
|
||||||
# ldapConfBase = ou=conf,ou=applications,dc=example,dc=com
|
|
||||||
# ldapBindDN = cn=manager,dc=example,dc=com
|
|
||||||
# ldapBindPassword = secret
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# 2 - LocalStorage
|
|
||||||
#
|
|
||||||
# To increase performances, use a local cache for the configuration. You have
|
|
||||||
# to choose a Cache::Cache module and set it's parameters (1 line). Example:
|
|
||||||
#
|
|
||||||
# localStorage = Cache::FileCache
|
|
||||||
# localStorageOptions = { 'namespace' => 'MyNamespace', 'default_expires_in' => 600, 'directory_umask' => '007', 'cache_root' => '/tmp', 'cache_depth' => 5, }
|
|
||||||
|
|
||||||
type = File
|
|
||||||
dirName = /var/lib/lemonldap-ng/conf
|
|
||||||
localStorage = Cache::FileCache
|
|
||||||
localStorageOptions = { 'namespace' => 'MyNamespace', 'default_expires_in' => 600, 'directory_umask' => '007', 'cache_root' => '/tmp', 'cache_depth' => 5, }
|
|
|
@ -14,6 +14,8 @@ BEGIN { use_ok('Lemonldap::NG::Common::Conf') }
|
||||||
# its man page ( perldoc Test::More ) for help writing this test script.
|
# its man page ( perldoc Test::More ) for help writing this test script.
|
||||||
|
|
||||||
my $h;
|
my $h;
|
||||||
|
my $inifile = "lemonldap-ng.ini";
|
||||||
|
my $confsection = "configuration";
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
(
|
(
|
||||||
|
@ -26,5 +28,11 @@ ok(
|
||||||
|
|
||||||
$h = bless {}, 'Lemonldap::NG::Common::Conf';
|
$h = bless {}, 'Lemonldap::NG::Common::Conf';
|
||||||
|
|
||||||
ok( $h->_readConfFile('storage.conf'), 'Read storage.conf' );
|
ok(
|
||||||
|
(
|
||||||
|
%$h = (%$h , %{ $h->getLocalConf( $confsection, $inifile, 0) })
|
||||||
|
and exists $h->{localStorage}
|
||||||
|
),
|
||||||
|
"Read $inifile"
|
||||||
|
);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ use strict;
|
||||||
use Lemonldap::NG::Handler::Simple qw(:all);
|
use Lemonldap::NG::Handler::Simple qw(:all);
|
||||||
use Lemonldap::NG::Handler::Vhost;
|
use Lemonldap::NG::Handler::Vhost;
|
||||||
use Lemonldap::NG::Common::Conf; #link protected lmConf
|
use Lemonldap::NG::Common::Conf; #link protected lmConf
|
||||||
|
use Lemonldap::NG::Common::Conf::Constants; #inherits
|
||||||
use Cache::Cache qw($EXPIRES_NEVER);
|
use Cache::Cache qw($EXPIRES_NEVER);
|
||||||
|
|
||||||
use base qw(Lemonldap::NG::Handler::Vhost Lemonldap::NG::Handler::Simple);
|
use base qw(Lemonldap::NG::Handler::Vhost Lemonldap::NG::Handler::Simple);
|
||||||
|
@ -90,7 +91,7 @@ sub localInit {
|
||||||
Lemonldap::NG::Common::Conf->new( $args->{configStorage} ) );
|
Lemonldap::NG::Common::Conf->new( $args->{configStorage} ) );
|
||||||
|
|
||||||
# Get local configuration parameters
|
# Get local configuration parameters
|
||||||
my $localconf = $lmConf->getLocalConf("handler");
|
my $localconf = $lmConf->getLocalConf( HANDLERSECTION );
|
||||||
$args->{$_} ||= $localconf->{$_} foreach ( keys %$localconf );
|
$args->{$_} ||= $localconf->{$_} foreach ( keys %$localconf );
|
||||||
|
|
||||||
# Store in localConfig global variable
|
# Store in localConfig global variable
|
||||||
|
|
|
@ -59,11 +59,12 @@ sub msafe {
|
||||||
sub new {
|
sub new {
|
||||||
my ( $class, $args ) = @_;
|
my ( $class, $args ) = @_;
|
||||||
my $self = $class->SUPER::new();
|
my $self = $class->SUPER::new();
|
||||||
|
%$self = ( %$self, %$args );
|
||||||
|
|
||||||
# TODO load global configuration parameters ?
|
# TODO load global configuration parameters ?
|
||||||
|
|
||||||
# Try to load local configuration parameters to get 'protection'
|
# Try to load local configuration parameters to get 'protection'
|
||||||
my $localconf = $self->config->getLocalConf("manager");
|
my $localconf = $self->config->getLocalConf( MANAGERSECTION );
|
||||||
$args->{protection} ||= $localconf->{protection};
|
$args->{protection} ||= $localconf->{protection};
|
||||||
|
|
||||||
if ( $args->{protection} ) {
|
if ( $args->{protection} ) {
|
||||||
|
@ -73,7 +74,6 @@ sub new {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Now push all local configuration parameters
|
# Now push all local configuration parameters
|
||||||
%$self = ( %$self, %$args );
|
|
||||||
$self->{$_} = $args->{$_} || $localconf->{$_} foreach ( keys %$localconf );
|
$self->{$_} = $args->{$_} || $localconf->{$_} foreach ( keys %$localconf );
|
||||||
|
|
||||||
foreach (qw(dhtmlXTreeImageLocation)) {
|
foreach (qw(dhtmlXTreeImageLocation)) {
|
||||||
|
|
|
@ -8,6 +8,7 @@ package Lemonldap::NG::Portal::SharedConf;
|
||||||
use strict;
|
use strict;
|
||||||
use Lemonldap::NG::Portal::Simple qw(:all);
|
use Lemonldap::NG::Portal::Simple qw(:all);
|
||||||
use Lemonldap::NG::Common::Conf; #link protected lmConf Configuration
|
use Lemonldap::NG::Common::Conf; #link protected lmConf Configuration
|
||||||
|
use Lemonldap::NG::Common::Conf::Constants; #inherits
|
||||||
|
|
||||||
*EXPORT_OK = *Lemonldap::NG::Portal::Simple::EXPORT_OK;
|
*EXPORT_OK = *Lemonldap::NG::Portal::Simple::EXPORT_OK;
|
||||||
*EXPORT_TAGS = *Lemonldap::NG::Portal::Simple::EXPORT_TAGS;
|
*EXPORT_TAGS = *Lemonldap::NG::Portal::Simple::EXPORT_TAGS;
|
||||||
|
@ -87,7 +88,7 @@ sub _getLocalLmConf {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get local configuration parameters for portal
|
# Get local configuration parameters for portal
|
||||||
return $self->{lmConf}->getLocalConf("portal");
|
return $self->{lmConf}->getLocalConf( PORTALSECTION );
|
||||||
}
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user