Skip to content
Browse files

Added --no-default-middleware option to plackup. Fixes #290

  • Loading branch information...
1 parent 7f851c7 commit 09e203453b64bdd72f47fbb62422d266fbc2958f @miyagawa miyagawa committed Aug 13, 2012
Showing with 15 additions and 5 deletions.
  1. +8 −4 lib/Plack/Runner.pm
  2. +7 −1 scripts/plackup
View
12 lib/Plack/Runner.pm
@@ -12,6 +12,7 @@ sub new {
loader => 'Plack::Loader',
includes => [],
modules => [],
+ default_middleware => 1,
@_,
}, $class;
}
@@ -56,6 +57,7 @@ sub parse_options {
"access-log=s" => \$self->{access_log},
"h|help" => \$self->{help},
"v|version" => \$self->{version},
+ "default-middleware!" => \$self->{default_middleware},
);
my(@options, @argv);
@@ -193,10 +195,12 @@ sub apply_middleware {
sub prepare_devel {
my($self, $app) = @_;
- $app = $self->apply_middleware($app, 'Lint');
- $app = $self->apply_middleware($app, 'StackTrace');
- if (!$ENV{GATEWAY_INTERFACE} and !$self->{access_log}) {
- $app = $self->apply_middleware($app, 'AccessLog');
+ if ($self->{default_middleware}) {
+ $app = $self->apply_middleware($app, 'Lint');
+ $app = $self->apply_middleware($app, 'StackTrace');
+ if (!$ENV{GATEWAY_INTERFACE} and !$self->{access_log}) {
+ $app = $self->apply_middleware($app, 'AccessLog');
+ }
}
push @{$self->{options}}, server_ready => sub {
View
8 scripts/plackup
@@ -166,7 +166,13 @@ or frameworks to tell which environment setting the application is running on.
Common values are C<development>, C<deployment>, and C<test>. The default value
is C<development>, which causes C<plackup> to load the middleware components:
-I<AccessLog>, I<StackTrace> and I<Lint>.
+I<AccessLog>, I<StackTrace> and I<Lint> unless when C<--no-default-middleware>
+is set.
+
+=item --no-default-middleware
+
+This prevents loading default middleware stack even when Plack
+environment (i.e. C<-E> or C<PLACK_ENV>) is set to C<development>.
=item -r, --reload

0 comments on commit 09e2034

Please sign in to comment.
Something went wrong with that request. Please try again.