lemonldap-ng/lemonldap-ng-common/eg/llng-app.psgi

51 lines
1.1 KiB
Plaintext
Raw Normal View History

2018-03-15 15:45:21 +01:00
#!/usr/bin/perl
use Plack::Builder;
2018-03-15 17:27:09 +01:00
# Basic test app
2018-03-15 15:45:21 +01:00
my $testApp = sub {
my ($env) = @_;
return [
200,
[ 'Content-Type' => 'text/plain' ],
2018-03-15 17:27:09 +01:00
[ "Hello LLNG world\n\n" . Dumper($env) ],
2018-03-15 15:45:21 +01:00
];
};
2018-03-15 17:27:09 +01:00
# Build protected app
2018-03-15 15:45:21 +01:00
my $test = builder {
enable "Auth::LemonldapNG";
$testApp;
};
2018-03-15 17:27:09 +01:00
# Build portal app
2018-03-15 15:45:21 +01:00
use Lemonldap::NG::Portal::Main;
my $portal = builder {
enable "Plack::Middleware::Static",
path => '^/static/',
2018-03-15 17:27:09 +01:00
root => '__PORTALSITEDIR__';
2018-03-15 15:45:21 +01:00
Lemonldap::NG::Portal::Main->run( {} );
};
2018-03-15 17:27:09 +01:00
# Build manager app
2018-03-15 15:45:21 +01:00
use Lemonldap::NG::Manager;
my $manager = builder {
enable "Plack::Middleware::Static",
path => '^/static/',
2018-03-15 17:27:09 +01:00
root => '__MANAGERSITEDIR__';
2018-03-15 15:45:21 +01:00
enable "Plack::Middleware::Static",
path => '^/doc/',
2018-03-15 17:27:09 +01:00
root => '__DEFDOCDIR__../';
2018-03-15 15:45:21 +01:00
enable "Plack::Middleware::Static",
path => '^/lib/',
2018-03-15 17:27:09 +01:00
root => '__DEFDOCDIR__pages/documentation/current/';
2018-03-15 15:45:21 +01:00
Lemonldap::NG::Manager->run( {} );
};
2018-03-15 17:27:09 +01:00
# Global app
2018-03-15 15:45:21 +01:00
builder {
mount 'http://test1.example.com/' => $test;
mount 'http://auth.example.com/' => $portal;
mount 'http://manager.example.com/' => $manager;
};