diff --git a/public/dispatch.cgi b/public/dispatch.cgi index a7bd42d..ea558ca 100755 --- a/public/dispatch.cgi +++ b/public/dispatch.cgi @@ -1,5 +1,13 @@ #!/usr/bin/env perl -use Plack::Runner; use Dancer ':syntax'; -my $psgi = path(dirname(__FILE__), '..', 'PEG.pl'); +use FindBin '$RealBin'; +use Plack::Runner; + +# For some reason Apache SetEnv directives dont propagate +# correctly to the dispatchers, so forcing PSGI and env here +# is safer. +set apphandler => 'PSGI'; +set environment => 'production'; + +my $psgi = path($RealBin, '..', 'bin', 'app.pl'); Plack::Runner->run($psgi); diff --git a/public/dispatch.fcgi b/public/dispatch.fcgi index 509ebff..57abd6b 100755 --- a/public/dispatch.fcgi +++ b/public/dispatch.fcgi @@ -1,8 +1,16 @@ #!/usr/bin/env perl -use Plack::Handler::FCGI; use Dancer ':syntax'; +use FindBin '$RealBin'; +use Plack::Handler::FCGI; -my $psgi = path(dirname(__FILE__), '..', 'PEG.pl'); +# For some reason Apache SetEnv directives dont propagate +# correctly to the dispatchers, so forcing PSGI and env here +# is safer. +set apphandler => 'PSGI'; +set environment => 'production'; + +my $psgi = path($RealBin, '..', 'bin', 'app.pl'); my $app = do($psgi); -my $server = Plack::Handler::FCGI->new(nproc => 5, detach => 1); +my $server = Plack::Handler::FCGI->new(nproc => 5, detach => 1); + $server->run($app);