webgui/app.psgi
Patrick Donelan 5c70ffb3e0 Minor improvements
Updated TODO
Enabled preloading
Added defaultPSGI to WebGUI::Paths
Added example of testing site via Plack::Test
2010-04-18 14:51:24 -04:00

22 lines
607 B
Perl

use strict;
use Plack::Builder;
use WebGUI::Paths -preload;
use WebGUI::Config;
builder {
my $first_app;
for my $config_file (WebGUI::Paths->siteConfigs) {
my $config = WebGUI::Config->new($config_file);
my $psgi = $config->get('psgiFile') || WebGUI::Paths->defaultPsgi;
my $app = do {
$ENV{WEBGUI_CONFIG} = $config_file;
Plack::Util::load_psgi($psgi);
};
$first_app ||= $app;
for my $sitename ( @{ $config->get('sitename') } ) {
mount "http://$sitename/" => $app;
}
}
mount '/' => $first_app;
};