Commit ff6ae38d authored by Yadd's avatar Yadd

Manage all portal scripts with fastcgi server (Closes: #929)

parent f6ff2e61
......@@ -237,7 +237,7 @@ minify: $(JSDSTFILES) $(CSSDSTFILES)
# Perl libraries configuration
#
json: $(MANAGERJSONDST) debian/llng-fastcgi-server.1p
json: $(MANAGERJSONDST) fastcgi-server/man/llng-fastcgi-server.1p
@if which yui-compressor; then $(MAKE) minify; fi
$(MANAGERJSONDST): $(MANAGERJSONSRC)
......
......@@ -3,13 +3,14 @@ server {
server_name auth.__DNSDOMAIN__;
root __PORTALDIR__;
rewrite ^/$ /auth.psgi last;
rewrite ^/$ /index.pl last;
location /auth.psgi {
location ~ \.pl$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass __PSGISERVERSOCKET__;
fastcgi_param LLTYPE auth;
fastcgi_param SCRIPT_NAME /manager.psgi;
fastcgi_param SCRIPT_NAME $document_root$fastcgi_script_name;
fascgi_split_path_info ^(.*\.pl)(/.+)$;
}
location / {
......
......@@ -28,8 +28,13 @@ my %builder = (
auth => sub {
require CGI::Emulate::PSGI;
require CGI::Compile;
return CGI::Emulate::PSGI->handler(
CGI::Compile->compile('lemonldap-ng-portal/example/index.pl') );
return sub {
my $script = $_[0]->{SCRIPTNAME};
return $_apps{$script}->(@_) if ( $_apps{$script} );
$_apps{$script} =
CGI::Emulate::PSGI->handler( CGI::Compile->compile($script) );
return $_app{$script}->(@_);
};
},
test => sub {
require CGI::Emulate::PSGI;
......
......@@ -14,7 +14,6 @@ getopts( 'n:p:s:u:g:', \%opts );
$opts{n} ||= $ENV{NPROC} || 7;
$opts{p} ||= $ENV{PID} || '/run/llng-fastcgi.pid';
$opts{s} ||= $ENV{SOCKET} || '/run/llng-fastcgi.sock';
$opts{a} ||= $ENV{PORTAL_PATH} || '/var/lib/lemonldap-ng/portal';
$opts{u} ||= $ENV{USER};
$opts{g} ||= $ENV{GROUP};
......@@ -40,8 +39,13 @@ my %builder = (
auth => sub {
require CGI::Emulate::PSGI;
require CGI::Compile;
return CGI::Emulate::PSGI->handler(
CGI::Compile->compile("$opts{a}/index.pl") );
return sub {
my $script = $_[0]->{SCRIPTNAME};
return $_apps{$script}->(@_) if ( $_apps{$script} );
$_apps{$script} =
CGI::Emulate::PSGI->handler( CGI::Compile->compile($script) );
return $_app{$script}->(@_);
};
},
);
......
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