source: server/trunk/web/lib/Sophie.pm @ 55

Last change on this file since 55 was 42, checked in by nanardon, 14 years ago
  • add dump/load distrib config using Yaml
  • separate DB connection for session
File size: 2.6 KB
Line 
1package Sophie;
2use Moose;
3use namespace::autoclean;
4use Catalyst::Runtime 5.80;
5use Sophie::Base;
6
7# Set flags and add plugins for the application
8#
9#         -Debug: activates the debug mode for very useful log messages
10#   ConfigLoader: will load the configuration from a Config::General file in the
11#                 application's home directory
12# Static::Simple: will serve static files from the application's root
13#                 directory
14
15use Catalyst qw/
16    ConfigLoader
17    Static::Simple
18    Session
19    Session::Store::DBI
20    Session::State::Cookie
21    Compress::Zlib
22    Server
23    Server::XMLRPC
24    Authentication
25/;
26
27use RPC::XML;
28$RPC::XML::FORCE_STRING_ENCODING = 1;
29
30extends 'Catalyst';
31
32our $VERSION = '0.01';
33$VERSION = eval $VERSION;
34
35# Configure the application.
36#
37# Note that settings in sophie.conf (or other external
38# configuration file that you set up manually) take precedence
39# over this when using ConfigLoader. Thus configuration
40# details given here can function as a default configuration,
41# with an external configuration file acting as an override for
42# local deployment.
43
44__PACKAGE__->config(
45    name => 'Sophie',
46    # Disable deprecated behavior needed by old applications
47    disable_component_resolution_regex_fallback => 1,
48    default_view => 'TT',
49    xmlrpc => {
50        xml_encoding => 'UTF-8',
51    },
52
53    'authentication' => {
54        default_realm => 'members',
55        realms => {
56            members => {
57                credential => {
58                    class => 'Password',
59                    password_field => 'password',
60                    password_type => 'crypted'
61                },
62                store => {
63                    class => 'DBIx::Class',
64                    user_model => 'Base::Users',
65                    role_relation => 'UsersRoles',
66                    role_field => 'rolename',
67                    id_field => 'mail',
68                },
69            },
70        },
71    },
72);
73
74__PACKAGE__->config->{session} = {
75    expires   => 3600,
76    dbi_dbh   => 'Session',
77    dbi_table => 'sessions',
78#    dbi_dsn => 'dbi:Pg:' . $config->{dbconnect},
79#    dbi_user => $config->{dbuser},
80#    dbi_pass => $config->{dbpassword},
81};
82
83# Start the application
84__PACKAGE__->setup();
85
86=head1 NAME
87
88Sophie - Catalyst based application
89
90=head1 SYNOPSIS
91
92    script/sophie_server.pl
93
94=head1 DESCRIPTION
95
96[enter your description here]
97
98=head1 SEE ALSO
99
100L<Sophie::Controller::Root>, L<Catalyst>
101
102=head1 AUTHOR
103
104Olivier Thauvin
105
106=head1 LICENSE
107
108This library is free software. You can redistribute it and/or modify
109it under the same terms as Perl itself.
110
111=cut
112
1131;
Note: See TracBrowser for help on using the repository browser.