Commit 3b083ee9 authored by Yadd's avatar Yadd

Status for Nginx (#934)

parent 6bd45f2f
......@@ -10,6 +10,7 @@ BEGIN {
use lib "$pwd/lemonldap-ng-handler/blib/lib";
use lib "$pwd/lemonldap-ng-portal/blib/lib";
use lib "$pwd/lemonldap-ng-manager/blib/lib";
use Lemonldap::NG::Handler::SharedConf;
};
die $@ if ($@);
}
......@@ -21,6 +22,10 @@ my %builder = (
require Lemonldap::NG::Handler::Nginx;
return Lemonldap::NG::Handler::Nginx->run( {} );
},
status => sub {
require Lemonldap::NG::Handler::Nginx;
return Lemonldap::NG::Handler::Nginx->status();
},
manager => sub {
require Lemonldap::NG::Manager;
return Lemonldap::NG::Manager->run( {} );
......@@ -33,7 +38,7 @@ my %builder = (
return $_apps{$script}->(@_) if ( $_apps{$script} );
$_apps{$script} =
CGI::Emulate::PSGI->handler( CGI::Compile->compile($script) );
return $_app{$script}->(@_);
return $_apps{$script}->(@_);
};
},
test => sub {
......@@ -44,6 +49,8 @@ my %builder = (
},
);
Lemonldap::NG::Handler::SharedConf->init();
sub {
my $type = $_[0]->{LLTYPE} || 'handler';
return $_apps{$type}->(@_) if ( defined $_apps{$type} );
......
......@@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "llng-fastcgi-server 1"
.TH llng-fastcgi-server 1 "2016-02-07" "perl v5.22.1" "User Contributed Perl Documentation"
.TH llng-fastcgi-server 1 "2016-02-11" "perl v5.22.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
......
......@@ -5,6 +5,7 @@ use strict;
use warnings;
use POSIX;
use Getopt::Std;
use Lemonldap::NG::Handler::SharedConf;
our %opts;
my %_apps;
......@@ -32,6 +33,10 @@ my %builder = (
require Lemonldap::NG::Handler::Nginx;
return Lemonldap::NG::Handler::Nginx->run( {} );
},
status => sub {
require Lemonldap::NG::Handler::Nginx;
return Lemonldap::NG::Handler::Nginx->status();
},
manager => sub {
require Lemonldap::NG::Manager;
return Lemonldap::NG::Manager->run( {} );
......@@ -63,6 +68,8 @@ my $app = sub {
die "Unknown PSGI type $type";
};
Lemonldap::NG::Handler::SharedConf->init();
my $server = Plack::Runner->new();
$server->parse_options(
'-s' => 'FCGI',
......
......@@ -70,6 +70,21 @@ sub _run {
}
}
sub status {
my $class = shift;
# Check if main handler initialization has been done
unless (%$tsv) {
eval { Lemonldap::NG::Handler::SharedConf->checkConf() };
$class->lmLog( $@, 'error' ) if ($@);
}
return sub {
Lemonldap::NG::Handler::API->newRequest(
Lemonldap::NG::Common::PSGI::Request->new( $_[0] ) );
$class->SUPER::status();
};
}
## @method private PSGI-Response _authAndTrace($req)
# Launch Lemonldap::NG::Handler::SharedConf::run() and then handler() if
# response is 200.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment