Commit b18e3b88 authored by Yadd's avatar Yadd

Backport #1035)

parent 00b90996
......@@ -13,3 +13,6 @@ GROUP=__GROUP__
# Custom functions file
#CUSTOM_FUNCTIONS_FILE=/var/lib/lemonldap-ng/myfile.pm
# Engine (default to FCGI)
#ENGINE=AnyEvent::FCGI
......@@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "llng-fastcgi-server 1"
.TH llng-fastcgi-server 1 "2016-05-31" "perl v5.22.2" "User Contributed Perl Documentation"
.TH llng-fastcgi-server 1 "2016-06-09" "perl v5.22.2" "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
......@@ -153,6 +153,25 @@ llng-fastcgi-server has been designed provides Lemonldap::NG services to Nginx.
Portal, manager and handler will be compiled only is used. So this FastCGI
server can be used on every Lemonldap::NG server even if it needs only some
parts (isolated handlers, portal,...).
.SH "PARAMETERS"
.IX Header "PARAMETERS"
Each parameter can be set by an option or a environment variable.
.IP "\-p ($ENV{\s-1PID\s0}): pid file" 4
.IX Item "-p ($ENV{PID}): pid file"
.PD 0
.IP "\-u ($ENV{\s-1USER\s0}): user" 4
.IX Item "-u ($ENV{USER}): user"
.IP "\-g ($ENV{\s-1GROUP\s0}): group" 4
.IX Item "-g ($ENV{GROUP}): group"
.IP "\-n ($ENV{\s-1NPROC\s0}): Number of processus for \s-1FCGI\s0" 4
.IX Item "-n ($ENV{NPROC}): Number of processus for FCGI"
.IP "\-e ($ENV{\s-1ENGINE\s0}): Plack::Handler engine, default to \s-1FCGI\s0" 4
.IX Item "-e ($ENV{ENGINE}): Plack::Handler engine, default to FCGI"
.IP "\-s ($ENV{\s-1SOCKET\s0}): Unix socket" 4
.IX Item "-s ($ENV{SOCKET}): Unix socket"
.IP "\-f ($ENV{\s-1CUSTOM_FUNCTIONS_FILE\s0}): file to load for custom functions" 4
.IX Item "-f ($ENV{CUSTOM_FUNCTIONS_FILE}): file to load for custom functions"
.PD
.SH "SEE ALSO"
.IX Header "SEE ALSO"
<http://lemonldap\-ng.org/>
......
......@@ -9,8 +9,11 @@ use Getopt::Std;
our %opts;
my %_apps;
getopts( 'Fn:p:s:u:g:f:', \%opts );
getopts( 'Fn:p:s:u:g:f:e:', \%opts );
$SIG{'PIPE'} = 'IGNORE';
$opts{e} ||= $ENV{ENGINE} || 'FCGI';
$opts{n} ||= $ENV{NPROC} || 7;
$opts{p} ||= $ENV{PID} || '__FASTCGISOCKDIR__/llng-fastcgi.pid';
$opts{s} ||= $ENV{SOCKET} || '__FASTCGISOCKDIR__/llng-fastcgi.sock';
......@@ -28,9 +31,9 @@ if ( $opts{u} ) {
POSIX::setuid($uid);
}
if($opts{f}) {
eval {require $opts{f}};
die $@ if($@);
if ( $opts{f} ) {
eval { require $opts{f} };
die $@ if ($@);
}
my %builder = (
......@@ -79,7 +82,7 @@ Lemonldap::NG::Handler::PSGI::API->init();
my $server = Plack::Runner->new();
$server->parse_options(
'-s' => 'FCGI',
'-s' => $opts{e},
'-E' => 'deployment',
'--pid' => $opts{p},
'--nproc' => $opts{n},
......@@ -111,6 +114,28 @@ Portal, manager and handler will be compiled only is used. So this FastCGI
server can be used on every Lemonldap::NG server even if it needs only some
parts (isolated handlers, portal,...).
=head1 PARAMETERS
Each parameter can be set by an option or a environment variable.
=over
=item -p ($ENV{PID}): pid file
=item -u ($ENV{USER}): user
=item -g ($ENV{GROUP}): group
=item -n ($ENV{NPROC}): Number of processus for FCGI
=item -e ($ENV{ENGINE}): Plack::Handler engine, default to FCGI
=item -s ($ENV{SOCKET}): Unix socket
=item -f ($ENV{CUSTOM_FUNCTIONS_FILE}): file to load for custom functions
=back
=head1 SEE ALSO
L<http://lemonldap-ng.org/>
......
......@@ -105,7 +105,6 @@ has body => ( is => 'rw', isa => 'Str', default => '' );
has CONTENT_TYPE => ( is => 'ro', isa => 'Str', reader => 'contentType', );
has CONTENT_LENGTH => (
is => 'ro',
isa => 'Int',
reader => 'contentLength',
lazy => 1,
default => 0,
......
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