Skip to content

Commit

Permalink
fixed typos
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Feb 6, 2012
1 parent 700d238 commit 16b34b8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 20 deletions.
35 changes: 17 additions & 18 deletions lib/Mojo/Server/Hypnotoad.pm
Expand Up @@ -53,7 +53,7 @@ sub run {
# Application
$ENV{HYPNOTOAD_APP} ||= abs_path $app;

# Config
# DEPRECATED in Leaf Fluttering In Wind!
$ENV{HYPNOTOAD_CONFIG} ||= abs_path $config;

# This is a production server
Expand All @@ -66,13 +66,10 @@ sub run {
# Clean start
exec $ENV{HYPNOTOAD_EXE} unless $ENV{HYPNOTOAD_REV}++;

# Preload application
# Preload application and configure server
my $daemon = $self->{daemon} = Mojo::Server::Daemon->new;
warn "APPLICATION $ENV{HYPNOTOAD_APP}\n" if DEBUG;
$daemon->load_app($ENV{HYPNOTOAD_APP});

# Load configuration
$self->_config;
$self->_config($daemon->load_app($ENV{HYPNOTOAD_APP}));

# Testing
_exit('Everything looks good!') if $ENV{HYPNOTOAD_TEST};
Expand Down Expand Up @@ -127,23 +124,26 @@ sub run {
}

sub _config {
my $self = shift;
my ($self, $app) = @_;

# Load configuration from application
my $c = $app->config('hypnotoad') || {};

# Load config file
# DEPRECATED in Leaf Fluttering In Wind!
my $file = $ENV{HYPNOTOAD_CONFIG};
warn "CONFIG $file\n" if DEBUG;
my $c = {};
if (-r $file) {
warn "Hypnotoad config files are DEPRECATED!\n";
unless ($c = do $file) {
die qq/Can't load config file "$file": $@/ if $@;
die qq/Can't load config file "$file": $!/ unless defined $c;
die qq/Config file "$file" did not return a hashref.\n/
unless ref $c eq 'HASH';
}
}
$self->{config} = $c;

# Hypnotoad settings
$self->{config} = $c;
$c->{graceful_timeout} ||= 30;
$c->{heartbeat_interval} ||= 5;
$c->{heartbeat_timeout} ||= 10;
Expand Down Expand Up @@ -417,7 +417,7 @@ Mojo::Server::Hypnotoad - ALL GLORY TO THE HYPNOTOAD!
use Mojo::Server::Hypnotoad;
my $toad = Mojo::Server::Hypnotoad->new;
$toad->run('./myapp.pl', './hypnotoad.conf');
$toad->run('./myapp.pl');
=head1 DESCRIPTION
Expand Down Expand Up @@ -447,7 +447,8 @@ See L<Mojolicious::Guides::Cookbook> for deployment recipes.
=head1 SIGNALS
You can control C<hypnotoad> at runtime with signals.
L<Mojo::Server::Hypnotoad> can be controlled at runtime with the following
signals.
=head2 Manager
Expand Down Expand Up @@ -506,12 +507,10 @@ Stop worker gracefully.
=head1 CONFIGURATION
C<Hypnotoad> configuration files are normal Perl scripts returning a hash.
# hypnotoad.conf
{listen => ['http://*:3000', 'http://*:4000'], workers => 10};
L<Mojo::Server::Hypnotoad> can be configured with the following setting.
The following parameters are currently available:
# myapp.conf
{hypnotoad => {listen => ['http://*:3000'], workers => 10}};
=head2 C<accepts>
Expand Down Expand Up @@ -643,7 +642,7 @@ implements the following new ones.
=head2 C<run>
$toad->run('script/myapp', 'hypnotoad.conf');
$toad->run('script/myapp');
Run server.
Expand Down
2 changes: 1 addition & 1 deletion script/hypnotoad
Expand Up @@ -8,7 +8,7 @@ use File::Spec;

push @INC, join('/', File::Spec->splitdir(dirname(__FILE__)), '..', 'lib');
unshift @INC, join('/', File::Spec->splitdir(dirname(__FILE__)), '..', 'lib')
if $ENV{TEST_MORBO};
if $ENV{TEST_HYPNOTOAD};

# Check if Mojolicious is installed
die <<EOF unless eval 'use Mojo::Server::Hypnotoad; 1';
Expand Down
2 changes: 1 addition & 1 deletion script/morbo
Expand Up @@ -8,7 +8,7 @@ use File::Spec;

push @INC, join('/', File::Spec->splitdir(dirname(__FILE__)), '..', 'lib');
unshift @INC, join('/', File::Spec->splitdir(dirname(__FILE__)), '..', 'lib')
if $ENV{TEST_HYPNOTOAD};
if $ENV{TEST_MORBO};

# Check if Mojolicious is installed
die <<EOF unless eval 'use Mojo::Server::Morbo; 1';
Expand Down

0 comments on commit 16b34b8

Please sign in to comment.