Changeset 92 in bookmarks
- Timestamp:
- 06/05/15 22:48:45 (10 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cpanfile
r80 r92 7 7 requires 'Template'; 8 8 requires 'Encode'; 9 10 # web application 11 requires 'Plack', '1.0036'; 9 12 10 13 # for opening the dbh handle -
trunk/lib/Bookmarks.pm
r88 r92 39 39 my $self = shift; 40 40 require File::Slurp; 41 require Fi ndBin;42 my $table_definitions = File::Slurp::read_file( "$FindBin::RealBin/bookmarks.sql");41 require File::Basename; 42 my $table_definitions = File::Slurp::read_file(File::Basename::dirname($INC{'Bookmarks.pm'}) . "/../bookmarks.sql"); 43 43 $self->dbh->{sqlite_allow_multiple_statements} = 1; 44 44 $self->dbh->do($table_definitions); -
trunk/lib/BookmarksApp.pm
r81 r92 17 17 my $self = shift; 18 18 19 -e $self->config_file or die "Config file " . $self->config_file . " not found\n";19 my $config = $self->config; 20 20 21 my $config = YAML::LoadFile($self->config_file); 22 $self->config($config); 21 # if the config_file is set, try to load the config from there 22 # note that currently, if there is a config_file and a config, 23 # all of the values in config are ignored in favor of those in 24 # the config_file 25 if ($self->config_file) { 26 -e $self->config_file or die "Config file " . $self->config_file . " not found\n"; 27 $config = YAML::LoadFile($self->config_file); 28 #TODO: merge the configs instead of overwriting? 29 $self->config($config); 30 } 23 31 24 32 my $router = router { … … 75 83 $self->_app( 76 84 builder { 77 enable_if { $_[0]->{REMOTE_ADDR} eq $config->{proxy_ip} } 'ReverseProxy'; 85 enable_if { $_[0]->{REMOTE_ADDR} eq $config->{proxy_ip} } 'ReverseProxy' 86 if $config->{proxy_ip}; 78 87 enable_if { $_[0]->{REQUEST_METHOD} ne 'GET' } 'Auth::Digest', ( 79 88 realm => 'Bookmarks', … … 81 90 password_hashed => 1, 82 91 authenticator => sub { $config->{digest_password} } 83 ) ;92 ) if $config->{auth}; 84 93 sub { $router->dispatch(shift); }; 85 94 }
Note: See TracChangeset
for help on using the changeset viewer.