You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.4 KiB
56 lines
1.4 KiB
#!/usr/bin/env perl
|
|
|
|
use warnings;
|
|
|
|
BEGIN {
|
|
$pwd = `pwd`;
|
|
chomp $pwd;
|
|
eval qq{
|
|
use lib "$pwd/lemonldap-ng-common/blib/lib";
|
|
use lib "$pwd/lemonldap-ng-handler/blib/lib";
|
|
use lib "$pwd/lemonldap-ng-portal/blib/lib";
|
|
use lib "$pwd/lemonldap-ng-manager/blib/lib";
|
|
};
|
|
die $@ if ($@);
|
|
}
|
|
|
|
my %_apps;
|
|
|
|
my %builder = (
|
|
handler => sub {
|
|
require Lemonldap::NG::Handler::Nginx;
|
|
return Lemonldap::NG::Handler::Nginx->run( {} );
|
|
},
|
|
manager => sub {
|
|
require Lemonldap::NG::Manager;
|
|
return Lemonldap::NG::Manager->run( {} );
|
|
},
|
|
auth => sub {
|
|
require CGI::Emulate::PSGI;
|
|
require CGI::Compile;
|
|
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;
|
|
require CGI::Compile;
|
|
return CGI::Emulate::PSGI->handler(
|
|
CGI::Compile->compile('e2e-tests/conf/site/index.pl') );
|
|
},
|
|
);
|
|
|
|
sub {
|
|
my $type = $_[0]->{LLTYPE} || 'handler';
|
|
return $_apps{$type}->(@_) if ( defined $_apps{$type} );
|
|
if ( defined $builder{$type} ) {
|
|
$_apps{$type} = $builder{$type}->();
|
|
return $_apps{$type}->(@_);
|
|
}
|
|
die "Unknown PSGI type $type";
|
|
};
|
|
|
|
|