Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
app.psgi is no longer a symlink to MetaCPAN::Server
  • Loading branch information
oalders committed Mar 12, 2014
1 parent cf2caee commit 999b447
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
1 change: 0 additions & 1 deletion app.psgi

This file was deleted.

11 changes: 11 additions & 0 deletions app.psgi
@@ -0,0 +1,11 @@
#!/usr/bin/env perl

use strict;
use warnings;

use FindBin;

use lib "$FindBin::RealBin/lib";

use MetaCPAN::Server;
MetaCPAN::Server::to_app();
1 change: 1 addition & 0 deletions cpanfile
Expand Up @@ -112,6 +112,7 @@ requires 'Path::Class::File';
requires 'PerlIO::gzip';
requires 'Pithub';
requires 'Plack::App::Directory';
requires 'Plack::Handler::Twiggy';
requires 'Plack::MIME';
requires 'Plack::Middleware::Header';
requires 'Plack::Middleware::ReverseProxy';
Expand Down
25 changes: 14 additions & 11 deletions lib/MetaCPAN/Server.pm
Expand Up @@ -77,19 +77,22 @@ __PACKAGE__->setup(
)
);

my $app = __PACKAGE__->apply_default_middlewares( __PACKAGE__->psgi_app );
sub to_app {
my $app = __PACKAGE__->apply_default_middlewares( __PACKAGE__->psgi_app );

# Should this be `unless ( $ENV{HARNESS_ACTIVE} ) {` ?
{
my $scoreboard = __PACKAGE__->path_to(qw(var tmp scoreboard));
# Should this be `unless ( $ENV{HARNESS_ACTIVE} ) {` ?
{
my $scoreboard = __PACKAGE__->path_to(qw(var tmp scoreboard));

# This may be a File object if it doesn't exist so change it, then make it.
Path::Class::Dir->new( $scoreboard->stringify )->mkpath;
Path::Class::Dir->new( $scoreboard->stringify )->mkpath;

Plack::Middleware::ServerStatus::Lite->wrap(
$app,
path => '/server-status',
allow => ['127.0.0.1'],
scoreboard => $scoreboard,
);
Plack::Middleware::ServerStatus::Lite->wrap(
$app,
path => '/server-status',
allow => ['127.0.0.1'],
scoreboard => $scoreboard,
);
}
return $app;
}

0 comments on commit 999b447

Please sign in to comment.