Plack servers support
Summary
Plack provides a family of powerful web servers. We simply have to build a Plack::Middleware::Auth::LemonldapNG module to support them
Full example
#!/usr/bin/perl
use Data::Dumper;
use Plack::Builder;
# Test
my $testApp = sub {
my ($env) = @_;
return [
200,
[ 'Content-Type' => 'text/plain' ],
[ "Hello world\n\n" . Dumper($env) ],
];
};
my $test = builder {
enable "Auth::LemonldapNG";
$testApp;
};
use Lemonldap::NG::Portal::Main;
my $portal = builder {
enable "Plack::Middleware::Static",
path => '^/static/',
root => '/path/to/portal/htdocs/';
Lemonldap::NG::Portal::Main->run( {} );
};
use Lemonldap::NG::Manager;
my $manager = builder {
enable "Plack::Middleware::Static",
path => '^/static/',
root => '/path/to/manager/htdocs/';
enable "Plack::Middleware::Static",
path => '^/doc/',
root => '/path/to/parent/of/doc/';
enable "Plack::Middleware::Static",
path => '^/lib/',
root => '/path/to/doc/pages/documentation/current/';
enable "Plack::Middleware::Static",
path => '^/fr-doc/',
root => '/path/to/parent/of/fr-doc/link/';
Lemonldap::NG::Manager->run( {} );
};
builder {
mount 'http://test1.example.com/' => $test;
mount 'http://auth.example.com/' => $portal;
mount 'http://manager.example.com/' => $manager;
};
Edited by Yadd