Changeset 65 in bookmarks
Legend:
- Unmodified
- Added
- Removed
-
trunk/app.psgi
r63 r65 9 9 use BookmarkController; 10 10 11 #TODO: allow a different config file on the command line, or set options from the command line11 #TODO: allow individual options to be set via environment vars, too 12 12 13 -e 'conf.yml' or die "Missing required conf.yml config file\n";13 -e $ENV{CONFIG_FILE} or die "Config file $ENV{CONFIG_FILE} not found\n"; 14 14 15 my $config = YAML::LoadFile( 'conf.yml');15 my $config = YAML::LoadFile($ENV{CONFIG_FILE}); 16 16 17 17 sub get_controller { 18 my $req = shift; 18 my $env = shift; 19 my $req = Plack::Request->new($env); 19 20 20 21 return BookmarkController->new({ … … 28 29 GET { 29 30 my ($env) = @_; 30 my $req = Plack::Request->new($env); 31 my $controller = get_controller($req); 31 my $controller = get_controller($env); 32 32 33 33 # check for a uri param, and if there is one present, … … 35 35 # redirect to that bookmark, and if not, show the form 36 36 # to create a new bookmark 37 if (defined $ req->param('uri')) {37 if (defined $controller->request->param('uri')) { 38 38 return $controller->find_or_new; 39 39 } … … 44 44 POST { 45 45 my ($env) = @_; 46 my $req = Plack::Request->new($env); 47 my $controller = get_controller($req); 46 my $controller = get_controller($env); 48 47 49 48 # create the bookmark and redirect to the new bookmark's edit form … … 55 54 GET { 56 55 my ($env) = @_; 57 my $req = Plack::Request->new($env); 58 my $controller = get_controller($req); 56 my $controller = get_controller($env); 59 57 60 58 return $controller->list; … … 65 63 GET { 66 64 my ($env) = @_; 67 my $req = Plack::Request->new($env); 68 my $controller = get_controller($req); 65 my $controller = get_controller($env); 69 66 70 67 return $controller->feed; … … 75 72 GET { 76 73 my ($env, $params) = @_; 77 my $req = Plack::Request->new($env); 78 my $controller = get_controller($req); 74 my $controller = get_controller($env); 79 75 80 76 return $controller->view($params->{id}); … … 82 78 POST { 83 79 my ($env, $params) = @_; 84 my $req = Plack::Request->new($env); 85 my $controller = get_controller($req); 80 my $controller = get_controller($env); 86 81 87 82 return $controller->update_and_redirect($params->{id}); … … 92 87 GET { 93 88 my ($env, $params) = @_; 94 my $req = Plack::Request->new($env); 95 my $controller = get_controller($req); 89 my $controller = get_controller($env); 96 90 97 91 return $controller->view_field($params->{id}, $params->{field}); -
trunk/start
r59 r65 1 1 #!/bin/sh 2 2 3 export CONFIG_FILE=${1:-"conf.yml"} 4 3 5 starman --listen :5000 --daemonize --pid pid --error-log errors --access-log access
Note: See TracChangeset
for help on using the changeset viewer.