Set configuration checkTime (#1454)
This commit is contained in:
parent
a725a8f28f
commit
f5971ad98d
|
@ -24,6 +24,7 @@ sub defaultValues {
|
||||||
'captcha_size' => 6,
|
'captcha_size' => 6,
|
||||||
'casAccessControlPolicy' => 'none',
|
'casAccessControlPolicy' => 'none',
|
||||||
'casAuthnLevel' => 1,
|
'casAuthnLevel' => 1,
|
||||||
|
'checkTime' => 600,
|
||||||
'checkXSS' => 1,
|
'checkXSS' => 1,
|
||||||
'confirmFormMethod' => 'post',
|
'confirmFormMethod' => 'post',
|
||||||
'cookieName' => 'lemonldap',
|
'cookieName' => 'lemonldap',
|
||||||
|
|
|
@ -19,8 +19,12 @@ sub grant {
|
||||||
my ( $class, $req, $session, $uri, $cond, $vhost ) = @_;
|
my ( $class, $req, $session, $uri, $cond, $vhost ) = @_;
|
||||||
$vhost ||= $class->resolveAlias($req);
|
$vhost ||= $class->resolveAlias($req);
|
||||||
$class->tsv->{lastVhostUpdate} //= {};
|
$class->tsv->{lastVhostUpdate} //= {};
|
||||||
unless ( $class->tsv->{defaultCondition}->{$vhost}
|
unless (
|
||||||
and ( time() - $class->tsv->{lastVhostUpdate}->{$vhost} < 600 ) )
|
$class->tsv->{defaultCondition}->{$vhost}
|
||||||
|
and (
|
||||||
|
time() - $class->tsv->{lastVhostUpdate}->{$vhost} <
|
||||||
|
$class->tsv->{checkTime} )
|
||||||
|
)
|
||||||
{
|
{
|
||||||
$class->loadVhostConfig( $req, $vhost );
|
$class->loadVhostConfig( $req, $vhost );
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ sub checkConf {
|
||||||
$class->logger->debug("Check configuration for $class");
|
$class->logger->debug("Check configuration for $class");
|
||||||
my $prm = { local => !$force, localPrm => $class->localConfig };
|
my $prm = { local => !$force, localPrm => $class->localConfig };
|
||||||
my $conf = $class->confAcc->getConf($prm);
|
my $conf = $class->confAcc->getConf($prm);
|
||||||
|
chomp $Lemonldap::NG::Common::Conf::msg;
|
||||||
|
|
||||||
unless ( ref($conf) ) {
|
unless ( ref($conf) ) {
|
||||||
$class->logger->error(
|
$class->logger->error(
|
||||||
|
@ -57,7 +58,6 @@ sub checkConf {
|
||||||
}
|
}
|
||||||
if ( $force or !$class->cfgNum or $class->cfgNum != $conf->{cfgNum} ) {
|
if ( $force or !$class->cfgNum or $class->cfgNum != $conf->{cfgNum} ) {
|
||||||
$class->logger->debug("Get configuration $conf->{cfgNum}");
|
$class->logger->debug("Get configuration $conf->{cfgNum}");
|
||||||
$class->lastCheck( time() );
|
|
||||||
unless ( $class->cfgNum( $conf->{cfgNum} ) ) {
|
unless ( $class->cfgNum( $conf->{cfgNum} ) ) {
|
||||||
$class->logger->error('No configuration available');
|
$class->logger->error('No configuration available');
|
||||||
return 0;
|
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");
|
$class->logger->debug("$class: configuration is up to date");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -759,6 +759,10 @@ qr/(?:(?:https?):\/\/(?:(?:(?:(?:(?:(?:[a-zA-Z0-9][-a-zA-Z0-9]*)?[a-zA-Z0-9])[.]
|
||||||
'checkStateSecret' => {
|
'checkStateSecret' => {
|
||||||
'type' => 'text'
|
'type' => 'text'
|
||||||
},
|
},
|
||||||
|
'checkTime' => {
|
||||||
|
'default' => 600,
|
||||||
|
'type' => 'int'
|
||||||
|
},
|
||||||
'checkXSS' => {
|
'checkXSS' => {
|
||||||
'default' => 1,
|
'default' => 1,
|
||||||
'type' => 'bool'
|
'type' => 'bool'
|
||||||
|
|
|
@ -215,6 +215,12 @@ sub attributes {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
|
checkTime => {
|
||||||
|
type => 'int',
|
||||||
|
documentation =>
|
||||||
|
'Timeout to check new configuration in local cache',
|
||||||
|
default => 600,
|
||||||
|
},
|
||||||
configStorage => {
|
configStorage => {
|
||||||
type => 'text',
|
type => 'text',
|
||||||
documentation => 'Configuration storage',
|
documentation => 'Configuration storage',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user