source: bookmarks/trunk/start @ 95

Last change on this file since 95 was 94, checked in by peter, 9 years ago

start script:

  • config file is given in a --file|-f switch
  • read the port to listen on from the config file (port setting); still defaults to 5000
  • Property svn:executable set to *
File size: 625 bytes
RevLine 
[93]1#!/usr/bin/perl -w
2use strict;
[54]3
[93]4use FindBin;
5use lib "$FindBin::RealBin/lib";
[65]6
[94]7use Getopt::Long;
8use YAML;
[93]9use Plack::Runner;
10use BookmarksApp;
11
[94]12GetOptions(
13    'file=s' => \my $CONFIG_FILE,
14);
[93]15
[94]16$CONFIG_FILE ||= 'conf.yml';
17-e $CONFIG_FILE or die "Config file $CONFIG_FILE not found\n";
18my $config = YAML::LoadFile($CONFIG_FILE);
19my $app = BookmarksApp->new({ config => $config })->to_app;
20
21my $listen = ':' . ($config->{port} || 5000);
22
[93]23my $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.