4a8f77a138844c63a0227e8ca428584bce759aa1
[scpubgit/stemmaweb.git] / lib / stemmaweb.pm
1 package stemmaweb;
2 use Moose;
3 use namespace::autoclean;
4
5 use Catalyst::Runtime 5.80;
6
7 use Search::GIN::Extract::Class;
8 use Search::GIN::Extract::Attributes;
9 use Search::GIN::Extract::Multiplex;
10
11 # Set flags and add plugins for the application.
12 #
13 # Note that ORDERING IS IMPORTANT here as plugins are initialized in order,
14 # therefore you almost certainly want to keep ConfigLoader at the head of the
15 # list if you're using it.
16 #
17 #         -Debug: activates the debug mode for very useful log messages
18 #   ConfigLoader: will load the configuration from a Config::General file in the
19 #                 application's home directory
20 # Static::Simple: will serve static files from the application's root
21 #                 directory
22
23 use Catalyst qw/
24     ConfigLoader
25     Static::Simple
26     Authentication
27     Session
28     Session::Store::File
29     Session::State::Cookie
30     StatusMessage
31     StackTrace
32 /;
33
34 extends 'Catalyst';
35
36 our $VERSION = '0.01';
37
38 # Configure the application.
39 #
40 # Note that settings in stemmaweb.conf (or other external
41 # configuration file that you set up manually) take precedence
42 # over this when using ConfigLoader. Thus configuration
43 # details given here can function as a default configuration,
44 # with an external configuration file acting as an override for
45 # local deployment.
46
47 __PACKAGE__->config(
48     name => 'stemmaweb',
49     # Disable deprecated behavior needed by old applications
50     disable_component_resolution_regex_fallback => 1,
51     # Set Unicode as the default
52     encoding => 'UTF-8',
53     default_view => 'TT',
54         'View::JSON' => {
55                 expose_stash => 'result',
56         },
57         'View::TT' => {
58                 INCLUDE_PATH => [
59                         stemmaweb->path_to( 'root', 'src' ),
60                 ],
61         },
62     ## kiokudb auth store testing
63     'Plugin::Authentication' => {
64         default => {
65             credential => {
66                 class => 'Password',
67                 password_field => 'password',
68                 password_type => 'self_check',
69             },
70             store => {
71                 class => 'Model::KiokuDB',
72                 model_name => 'Directory',
73             },
74         },
75         openid => {
76             credential => {
77                 class => 'OpenID',
78                 extensions => ['http://openid.net/srv/ax/1.0' => 
79                     {
80                         ns          => 'ax',
81                         uri         => 'http://openid.net/srv/ax/1.0',
82                         mode        => 'fetch_request',
83                         required    => 'email',
84                         'type.email' => 'http://axschema.org/contact/email',
85                         # type        => {
86                         #     email => 'http://axschema.org/contact/email'
87                         # }
88                     }
89                     ],
90             },
91             store => {
92                 class => 'Model::KiokuDB',
93                 model_name => 'Directory',
94             },
95             auto_create_user => 1,
96         },
97     },
98     ## Auth with CatalystX::Controller::Auth
99     'Controller::Users' => {
100         model => 'User',
101         login_id_field => 'username',
102         login_db_field => 'username',
103         action_after_login => '/users/success',
104         action_after_register => '/users/success', 
105         enable_sending_register_email => 0,
106         register_email_from  => '"Stemmaweb" <stemmaweb@byzantini.st>',
107         register_email_subject => 'Registration to stemmaweb',
108         register_email_template_plain => 'register-plain.tt',
109         realm => 'default',
110         login_fields => { openid => [qw/openid_identifier/],
111                           default => [qw/username password remember/],
112         },
113     },
114     'View::Email::Template' => {
115         stash_key => 'email_template',
116     },
117
118     recaptcha => {
119         pub_key => '6LfR19MSAAAAACy2meHvLfZGRn3PM2rRYIAfh665',
120         priv_key => '6LfR19MSAAAAAMlQb8BdyecWNRE1bAL2YSgz2sah',
121     },
122 );
123
124 # Start the application
125 __PACKAGE__->setup();
126
127
128 =head1 NAME
129
130 stemmaweb - Catalyst based application
131
132 =head1 SYNOPSIS
133
134     script/stemmaweb_server.pl
135
136 =head1 DESCRIPTION
137
138 [enter your description here]
139
140 =head1 SEE ALSO
141
142 L<stemmaweb::Controller::Root>, L<Catalyst>
143
144 =head1 AUTHOR
145
146 Tara L Andrews
147
148 =head1 LICENSE
149
150 This library is free software. You can redistribute it and/or modify
151 it under the same terms as Perl itself.
152
153 =cut
154
155 1;