source: bookmarks/trunk/app.psgi @ 55

Last change on this file since 55 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
Line 
1#!/usr/bin/perl -w
2use strict;
3
4use YAML;
5use Plack::Builder;
6
7use BookmarkApp::Dispatch;
8
9-e 'conf.yml' or die "Missing required conf.yml config file\n";
10
11my $config = YAML::LoadFile('conf.yml');
12my $app = BookmarkApp::Dispatch->as_psgi(
13    args_to_new => {
14        PARAMS => { dbname => $config->{dbname} },
15    },
16);
17
18builder {
19    enable_if { $_[0]->{REMOTE_ADDR} eq $config->{proxy_ip} } 'ReverseProxy';
20    enable_if { $_[0]->{REQUEST_METHOD} ne 'GET' } 'Auth::Digest', (
21        realm           => 'Bookmarks',
22        secret          => $config->{digest_key},
23        password_hashed => 1,
24        authenticator   => sub { $config->{digest_password} }
25    );
26    $app;
27};
Note: See TracBrowser for help on using the repository browser.