llng-app.psgi 1.25 KB
Newer Older
1 2 3 4 5
#!/usr/bin/perl

use Data::Dumper;
use Plack::Builder;

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

16
# Build protected app
17 18 19 20 21
my $test = builder {
    enable "Auth::LemonldapNG";
    $testApp;
};

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

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

49
# Global app
50 51 52 53 54
builder {
    mount 'http://test1.example.com/'   => $test;
    mount 'http://auth.example.com/'    => $portal;
    mount 'http://manager.example.com/' => $manager;
};