Merge branch 'fix-handler-psgi-logger-2632' into 'v2.0'

Transmit handler local config to handler psgi server init (#2632)

See merge request lemonldap-ng/lemonldap-ng!232
This commit is contained in:
Maxime Besson 2022-01-20 14:17:06 +00:00
commit db35ecf877
2 changed files with 6 additions and 6 deletions

View File

@ -16,12 +16,12 @@ has api => ( is => 'rw', isa => 'Str' );
sub init {
my ( $self, $args ) = @_;
eval { $self->api->init($args) };
if ( $@ and not( $self->{protection} and $self->{protection} eq 'none' ) ) {
if ( $@ and not( $args->{protection} and $args->{protection} eq 'none' ) ) {
$self->error($@);
return 0;
}
unless ( $self->api->checkConf($self)
or ( $self->{protection} and $self->{protection} eq 'none' ) )
or ( $args->{protection} and $args->{protection} eq 'none' ) )
{
$self->error(
"Unable to protect this server ($Lemonldap::NG::Common::Conf::msg)"
@ -30,7 +30,7 @@ sub init {
}
eval { $self->portal( $self->api->tsv->{portal}->() ) };
my $rule =
$self->{protection} || $self->api->localConfig->{protection} || '';
$args->{protection} || $self->api->localConfig->{protection} || '';
$self->rule(
$rule eq 'authenticate' ? 1 : $rule eq 'manager' ? '' : $rule );
return 1;

View File

@ -14,9 +14,9 @@ our $VERSION = '2.0.10';
sub init {
my ( $self, $args ) = @_;
$self->api('Lemonldap::NG::Handler::PSGI::Main') unless ( $self->api );
my $tmp = ( $self->Lemonldap::NG::Common::PSGI::init($args)
and $self->Lemonldap::NG::Handler::Lib::PSGI::init($args) );
return $tmp;
return 0 unless $self->Lemonldap::NG::Handler::Lib::PSGI::init($args);
return $self->Lemonldap::NG::Common::PSGI::init( $self->api->localConfig );
}
1;