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

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

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

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

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

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

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