diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm index 8f2952794..0319dcf97 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/Conf/DefaultValues.pm @@ -24,6 +24,7 @@ sub defaultValues { 'captcha_size' => 6, 'casAccessControlPolicy' => 'none', 'casAuthnLevel' => 1, + 'checkTime' => 600, 'checkXSS' => 1, 'confirmFormMethod' => 'post', 'cookieName' => 'lemonldap', diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/DevOps.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/DevOps.pm index ce7feefbe..38d603133 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/DevOps.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Lib/DevOps.pm @@ -19,8 +19,12 @@ sub grant { my ( $class, $req, $session, $uri, $cond, $vhost ) = @_; $vhost ||= $class->resolveAlias($req); $class->tsv->{lastVhostUpdate} //= {}; - unless ( $class->tsv->{defaultCondition}->{$vhost} - and ( time() - $class->tsv->{lastVhostUpdate}->{$vhost} < 600 ) ) + unless ( + $class->tsv->{defaultCondition}->{$vhost} + and ( + time() - $class->tsv->{lastVhostUpdate}->{$vhost} < + $class->tsv->{checkTime} ) + ) { $class->loadVhostConfig( $req, $vhost ); } diff --git a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Reload.pm b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Reload.pm index 11b4423cc..13f3a5eb8 100644 --- a/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Reload.pm +++ b/lemonldap-ng-handler/lib/Lemonldap/NG/Handler/Main/Reload.pm @@ -36,6 +36,7 @@ sub checkConf { $class->logger->debug("Check configuration for $class"); my $prm = { local => !$force, localPrm => $class->localConfig }; my $conf = $class->confAcc->getConf($prm); + chomp $Lemonldap::NG::Common::Conf::msg; unless ( ref($conf) ) { $class->logger->error( @@ -57,7 +58,6 @@ sub checkConf { } if ( $force or !$class->cfgNum or $class->cfgNum != $conf->{cfgNum} ) { $class->logger->debug("Get configuration $conf->{cfgNum}"); - $class->lastCheck( time() ); unless ( $class->cfgNum( $conf->{cfgNum} ) ) { $class->logger->error('No configuration available'); return 0; @@ -76,6 +76,8 @@ sub checkConf { } } } + $class->tsv->{checkTime} = $conf->{checkTime} if ( $conf->{checkTime} ); + $class->lastCheck( time() ); $class->logger->debug("$class: configuration is up to date"); return 1; } diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm index 4bfc5d158..40e5224a5 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Attributes.pm @@ -759,6 +759,10 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.] 'checkStateSecret' => { 'type' => 'text' }, + 'checkTime' => { + 'default' => 600, + 'type' => 'int' + }, 'checkXSS' => { 'default' => 1, 'type' => 'bool' diff --git a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Attributes.pm b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Attributes.pm index 42ee16f18..ec405b950 100644 --- a/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Attributes.pm +++ b/lemonldap-ng-manager/lib/Lemonldap/NG/Manager/Build/Attributes.pm @@ -215,6 +215,12 @@ sub attributes { return { # Other + checkTime => { + type => 'int', + documentation => + 'Timeout to check new configuration in local cache', + default => 600, + }, configStorage => { type => 'text', documentation => 'Configuration storage', @@ -1441,7 +1447,7 @@ sub attributes { grep { $_ =~ /Undefined subroutine/ ? () : $_ } split( /\n/, $@ ) ); return $err ? ( 1, "__badExpression__: $err" ) : (1); - } + } }, documentation => 'Virtualhost headers', flags => 'h',