Add llngapp.psgi that can replace FastCGI server
This commit is contained in:
parent
aeece8ef84
commit
ee163a076c
1
Makefile
1
Makefile
|
@ -787,6 +787,7 @@ install_examples_site:
|
||||||
@for i in portal manager; do \
|
@for i in portal manager; do \
|
||||||
cp -a -f lemonldap-ng-$$i/eg $(REXAMPLESDIR)/$$i; \
|
cp -a -f lemonldap-ng-$$i/eg $(REXAMPLESDIR)/$$i; \
|
||||||
done
|
done
|
||||||
|
@cp -a -f fastcgi-server/psgi/llngapp.psgi $(REXAMPLESDIR)/$$i
|
||||||
@rm -rf $(REXAMPLESDIR)/portal/skins \
|
@rm -rf $(REXAMPLESDIR)/portal/skins \
|
||||||
$(REXAMPLESDIR)/manager/skins \
|
$(REXAMPLESDIR)/manager/skins \
|
||||||
@rm -rf $$(find $(REXAMPLESDIR) -type d -name .svn)
|
@rm -rf $$(find $(REXAMPLESDIR) -type d -name .svn)
|
||||||
|
|
2
debian/control
vendored
2
debian/control
vendored
|
@ -137,10 +137,10 @@ Description: Lemonldap::NG FastCGI server
|
||||||
Package: lemonldap-ng-handler
|
Package: lemonldap-ng-handler
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: ${misc:Depends},
|
Depends: ${misc:Depends},
|
||||||
lemonldap-ng-fastcgi-server (= ${binary:Version}) | libapache2-mod-perl2,
|
|
||||||
liblemonldap-ng-handler-perl (= ${binary:Version})
|
liblemonldap-ng-handler-perl (= ${binary:Version})
|
||||||
Breaks: liblemonldap-ng-handler-perl (<< 1.9.1-2~)
|
Breaks: liblemonldap-ng-handler-perl (<< 1.9.1-2~)
|
||||||
Replaces: liblemonldap-ng-handler-perl (<< 1.9.1-2~)
|
Replaces: liblemonldap-ng-handler-perl (<< 1.9.1-2~)
|
||||||
|
Recommends: lemonldap-ng-fastcgi-server (= ${binary:Version}) | libapache2-mod-perl2
|
||||||
Description: Lemonldap::NG handler part
|
Description: Lemonldap::NG handler part
|
||||||
Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies
|
Lemonldap::NG is a complete Web-SSO system that can run with reverse-proxies
|
||||||
or directly on application webservers. It can be used in conjunction with
|
or directly on application webservers. It can be used in conjunction with
|
||||||
|
|
1
debian/lemonldap-ng.examples
vendored
Normal file
1
debian/lemonldap-ng.examples
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
fastcgi-server/psgi/llngapp.psgi
|
66
fastcgi-server/psgi/llngapp.psgi
Normal file
66
fastcgi-server/psgi/llngapp.psgi
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
# Plack app to use with Nginx
|
||||||
|
#
|
||||||
|
# This app can remplace FastCGI server using Starman, Twiggy, uWSGI-Plugin-PSGI,
|
||||||
|
# Feersum,...
|
||||||
|
|
||||||
|
my %builder = (
|
||||||
|
handler => sub {
|
||||||
|
require Lemonldap::NG::Handler::Server::Nginx;
|
||||||
|
return Lemonldap::NG::Handler::Server::Nginx->run( {} );
|
||||||
|
},
|
||||||
|
reload => sub {
|
||||||
|
require Lemonldap::NG::Handler::Server::Nginx;
|
||||||
|
return Lemonldap::NG::Handler::Server::Nginx->reload();
|
||||||
|
},
|
||||||
|
status => sub {
|
||||||
|
require Lemonldap::NG::Handler::Server::Nginx;
|
||||||
|
return Lemonldap::NG::Handler::Server::Nginx->status();
|
||||||
|
},
|
||||||
|
manager => sub {
|
||||||
|
require Lemonldap::NG::Manager;
|
||||||
|
return Lemonldap::NG::Manager->run( {} );
|
||||||
|
},
|
||||||
|
cgi => sub {
|
||||||
|
require CGI::Emulate::PSGI;
|
||||||
|
require CGI::Compile;
|
||||||
|
return sub {
|
||||||
|
my $script = $_[0]->{SCRIPT_FILENAME};
|
||||||
|
return $_apps{$script}->(@_) if ( $_apps{$script} );
|
||||||
|
$_apps{$script} =
|
||||||
|
CGI::Emulate::PSGI->handler( CGI::Compile->compile($script) );
|
||||||
|
return $_apps{$script}->(@_);
|
||||||
|
};
|
||||||
|
},
|
||||||
|
psgi => sub {
|
||||||
|
return sub {
|
||||||
|
my $script = $_[0]->{SCRIPT_FILENAME};
|
||||||
|
return $_apps{$script}->(@_) if ( $_apps{$script} );
|
||||||
|
$_apps{$script} = do $script;
|
||||||
|
unless ( $_apps{$script} and ref $_apps{$script} ) {
|
||||||
|
die "Unable to load $_[0]->{SCRIPT_FILENAME}";
|
||||||
|
}
|
||||||
|
return $_apps{$script}->(@_);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
unless ($>) {
|
||||||
|
die "Refuse to run as root. Aborting";
|
||||||
|
}
|
||||||
|
|
||||||
|
# Hook for customFunctions initialization
|
||||||
|
Lemonldap::NG::Handler::Main->onReload(
|
||||||
|
bless( {}, 'Lemonldap::NG::Handler::FastCGI::Loader' ),
|
||||||
|
'loadCustomHandlers' );
|
||||||
|
|
||||||
|
# Main routine
|
||||||
|
sub {
|
||||||
|
my $type = $_[0]->{LLTYPE} || 'handler';
|
||||||
|
return $_apps{$type}->(@_) if ( defined $_apps{$type} );
|
||||||
|
if ( defined $builder{$type} ) {
|
||||||
|
$_apps{$type} = $builder{$type}->();
|
||||||
|
return $_apps{$type}->(@_);
|
||||||
|
}
|
||||||
|
return [ 500, [], ["Unknown PSGI type $type"] ];
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user