Last change
on this file since 100 was
96,
checked in by peter, 9 years ago
|
changed the default server config file name to server.yml
|
-
Property svn:executable set to
*
|
File size:
627 bytes
|
Rev | Line | |
---|
[93] | 1 | #!/usr/bin/perl -w |
---|
| 2 | use strict; |
---|
[54] | 3 | |
---|
[93] | 4 | use FindBin; |
---|
| 5 | use lib "$FindBin::RealBin/lib"; |
---|
[65] | 6 | |
---|
[94] | 7 | use Getopt::Long; |
---|
| 8 | use YAML; |
---|
[93] | 9 | use Plack::Runner; |
---|
| 10 | use BookmarksApp; |
---|
| 11 | |
---|
[94] | 12 | GetOptions( |
---|
| 13 | 'file=s' => \my $CONFIG_FILE, |
---|
| 14 | ); |
---|
[93] | 15 | |
---|
[96] | 16 | $CONFIG_FILE ||= 'server.yml'; |
---|
[94] | 17 | -e $CONFIG_FILE or die "Config file $CONFIG_FILE not found\n"; |
---|
| 18 | my $config = YAML::LoadFile($CONFIG_FILE); |
---|
| 19 | my $app = BookmarksApp->new({ config => $config })->to_app; |
---|
| 20 | |
---|
| 21 | my $listen = ':' . ($config->{port} || 5000); |
---|
| 22 | |
---|
[93] | 23 | my $runner = Plack::Runner->new(server => 'Starman'); |
---|
[94] | 24 | $runner->parse_options(qw{--listen}, $listen, qw{--daemonize --pid pid --error-log errors --access-log access}); |
---|
[93] | 25 | $runner->run($app); |
---|
Note: See
TracBrowser
for help on using the repository browser.