Add reload method (closes: #1099)

This commit is contained in:
Xavier Guimard 2016-10-25 20:38:29 +00:00
parent f243e2d932
commit 789aa82d16

View File

@ -76,7 +76,9 @@ sub _run {
}
sub status {
my $self = shift;
my ( $class, $args ) = @_;
$args //= {};
my $self = $class->new($args);
# Check if main handler initialization has been done
unless ( %$self->api->tsv ) {
@ -90,6 +92,23 @@ sub status {
};
}
sub reload {
my ( $class, $args ) = @_;
$args //= {};
my $self = $class->new($args);
# Check if main handler initialization has been done
unless ( %$self->api->tsv ) {
eval { $self->api->checkConf() };
$self->lmLog( $@, 'error' ) if ($@);
}
return sub {
my $req = Lemonldap::NG::Common::PSGI::Request->new( $_[0] );
$self->api->reload($req);
return [ 200, [ @{ $req->{respHeaders} } ], [ $req->{respBody} ] ];
};
}
## @method private PSGI-Response _authAndTrace($req)
# Launch $self->api::run() and then handler() if
# response is 200.