llng-app.psgi 1.14 KB
Newer Older
Xavier Guimard's avatar
Xavier Guimard committed
1 2 3 4
#!/usr/bin/perl

use Plack::Builder;

Xavier Guimard's avatar
Xavier Guimard committed
5
# Basic test app
Xavier Guimard's avatar
Xavier Guimard committed
6 7 8 9 10
my $testApp = sub {
    my ($env) = @_;
    return [
        200,
        [ 'Content-Type' => 'text/plain' ],
Xavier Guimard's avatar
Xavier Guimard committed
11
        [ "Hello LLNG world\n\n" . Dumper($env) ],
Xavier Guimard's avatar
Xavier Guimard committed
12 13 14
    ];
};

Xavier Guimard's avatar
Xavier Guimard committed
15
# Build protected app
Xavier Guimard's avatar
Xavier Guimard committed
16 17 18 19 20
my $test = builder {
    enable "Auth::LemonldapNG";
    $testApp;
};

Xavier Guimard's avatar
Xavier Guimard committed
21
# Build portal app
Xavier Guimard's avatar
Xavier Guimard committed
22 23 24 25
use Lemonldap::NG::Portal::Main;
my $portal = builder {
    enable "Plack::Middleware::Static",
      path => '^/static/',
Xavier Guimard's avatar
Xavier Guimard committed
26
      root => '__PORTALSITEDIR__';
Xavier Guimard's avatar
Xavier Guimard committed
27 28 29
    Lemonldap::NG::Portal::Main->run( {} );
};

Xavier Guimard's avatar
Xavier Guimard committed
30
# Build manager app
Xavier Guimard's avatar
Xavier Guimard committed
31 32 33 34
use Lemonldap::NG::Manager;
my $manager = builder {
    enable "Plack::Middleware::Static",
      path => '^/static/',
Xavier Guimard's avatar
Xavier Guimard committed
35
      root => '__MANAGERSITEDIR__';
Xavier Guimard's avatar
Xavier Guimard committed
36 37
    enable "Plack::Middleware::Static",
      path => '^/doc/',
Xavier Guimard's avatar
Xavier Guimard committed
38
      root => '__DEFDOCDIR__../';
Xavier Guimard's avatar
Xavier Guimard committed
39 40
    enable "Plack::Middleware::Static",
      path => '^/lib/',
Xavier Guimard's avatar
Xavier Guimard committed
41
      root => '__DEFDOCDIR__pages/documentation/current/';
Xavier Guimard's avatar
Xavier Guimard committed
42 43 44
    Lemonldap::NG::Manager->run( {} );
};

Xavier Guimard's avatar
Xavier Guimard committed
45
# Global app
Xavier Guimard's avatar
Xavier Guimard committed
46 47 48 49 50
builder {
    mount 'http://test1.example.com/'   => $test;
    mount 'http://auth.example.com/'    => $portal;
    mount 'http://manager.example.com/' => $manager;
};