X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FScript%2FServer.pm;h=bb4c2a576db9bd2cbf32111a3a9ddc601a2cae9e;hb=0de7c4a458cb3d2420f20481ed5cddd20eb5d800;hp=80670d9248006f9367a110e23337bb9c76eb4299;hpb=3bd410a99cab04a6030397dc8c438889fa8567e3;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Script/Server.pm b/lib/Catalyst/Script/Server.pm index 80670d9..bb4c2a5 100644 --- a/lib/Catalyst/Script/Server.pm +++ b/lib/Catalyst/Script/Server.pm @@ -8,12 +8,11 @@ BEGIN { use Moose; use MooseX::Types::Common::Numeric qw/PositiveInt/; use MooseX::Types::Moose qw/ArrayRef Str Bool Int RegexpRef/; +use Catalyst::Utils; use namespace::autoclean; with 'Catalyst::ScriptRole'; -__PACKAGE__->meta->get_attribute('help')->cmd_aliases('?'); - has debug => ( traits => [qw(Getopt)], cmd_aliases => 'd', @@ -27,6 +26,7 @@ has host => ( cmd_aliases => 'h', isa => Str, is => 'ro', + # N.B. undef (the default) means we bind on all interfaces on the host. documentation => 'Specify a hostname or IP on this host for the server to bind to', ); @@ -44,7 +44,9 @@ has port => ( cmd_aliases => 'p', isa => PositiveInt, is => 'ro', - default => 3000, + default => sub { + Catalyst::Utils::env_value(shift->application_name, 'port') || 3000 + }, documentation => 'Specify a different listening port (to the default port 3000)', ); @@ -79,7 +81,9 @@ has restart => ( cmd_aliases => 'r', isa => Bool, is => 'ro', - default => 0, + default => sub { + Catalyst::Utils::env_value(shift->application_name, 'reload') || 0; + }, documentation => 'use Catalyst::Restarter to detect code changes and restart the application', ); @@ -184,6 +188,7 @@ sub _application_args { $self->port, $self->host, { + argv => $self->ARGV, map { $_ => $self->$_ } qw/ fork keepalive @@ -224,7 +229,7 @@ Catalyst::Script::Server - Catalyst test server a restart when modified (defaults to '\.yml$|\.yaml$|\.conf|\.pm$') --rdir --restart_directory the directory to search for - modified files, can be set mulitple times + modified files, can be set multiple times (defaults to '[SCRIPT_DIR]/..') --sym --follow_symlinks follow symlinks in search directories (defaults to false. this is a no-op on Win32)