Last change
on this file since 58 was
55,
checked in by peter, 11 years ago
|
store the digest authentication secret key in the conf.yml file as digest_key
|
-
Property svn:executable set to
*
|
File size:
681 bytes
|
Rev | Line | |
---|
[53] | 1 | #!/usr/bin/perl -w |
---|
| 2 | use strict; |
---|
| 3 | |
---|
| 4 | use YAML; |
---|
| 5 | use Plack::Builder; |
---|
| 6 | |
---|
| 7 | use BookmarkApp::Dispatch; |
---|
| 8 | |
---|
| 9 | -e 'conf.yml' or die "Missing required conf.yml config file\n"; |
---|
| 10 | |
---|
| 11 | my $config = YAML::LoadFile('conf.yml'); |
---|
| 12 | my $app = BookmarkApp::Dispatch->as_psgi( |
---|
| 13 | args_to_new => { |
---|
| 14 | PARAMS => { dbname => $config->{dbname} }, |
---|
| 15 | }, |
---|
| 16 | ); |
---|
| 17 | |
---|
| 18 | builder { |
---|
| 19 | enable_if { $_[0]->{REMOTE_ADDR} eq $config->{proxy_ip} } 'ReverseProxy'; |
---|
| 20 | enable_if { $_[0]->{REQUEST_METHOD} ne 'GET' } 'Auth::Digest', ( |
---|
| 21 | realm => 'Bookmarks', |
---|
[55] | 22 | secret => $config->{digest_key}, |
---|
[53] | 23 | password_hashed => 1, |
---|
| 24 | authenticator => sub { $config->{digest_password} } |
---|
| 25 | ); |
---|
| 26 | $app; |
---|
| 27 | }; |
---|
Note: See
TracBrowser
for help on using the repository browser.