[1] | 1 | package Sophie; |
---|
| 2 | use Moose; |
---|
| 3 | use namespace::autoclean; |
---|
| 4 | use Catalyst::Runtime 5.80; |
---|
[2] | 5 | use Sophie::Base; |
---|
[1] | 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 | |
---|
| 15 | use Catalyst qw/ |
---|
| 16 | ConfigLoader |
---|
| 17 | Static::Simple |
---|
[2] | 18 | Session |
---|
| 19 | Session::Store::DBI |
---|
| 20 | Session::State::Cookie |
---|
| 21 | Compress::Zlib |
---|
[19] | 22 | Server |
---|
| 23 | Server::XMLRPC |
---|
[4] | 24 | Authentication |
---|
[65] | 25 | Authorization::Roles |
---|
[77] | 26 | Prototype |
---|
[1] | 27 | /; |
---|
| 28 | |
---|
[4] | 29 | use RPC::XML; |
---|
| 30 | $RPC::XML::FORCE_STRING_ENCODING = 1; |
---|
| 31 | |
---|
[1] | 32 | extends 'Catalyst'; |
---|
| 33 | |
---|
| 34 | our $VERSION = '0.01'; |
---|
| 35 | $VERSION = eval $VERSION; |
---|
| 36 | |
---|
| 37 | # Configure the application. |
---|
| 38 | # |
---|
| 39 | # Note that settings in sophie.conf (or other external |
---|
| 40 | # configuration file that you set up manually) take precedence |
---|
| 41 | # over this when using ConfigLoader. Thus configuration |
---|
| 42 | # details given here can function as a default configuration, |
---|
| 43 | # with an external configuration file acting as an override for |
---|
| 44 | # local deployment. |
---|
| 45 | |
---|
| 46 | __PACKAGE__->config( |
---|
| 47 | name => 'Sophie', |
---|
| 48 | # Disable deprecated behavior needed by old applications |
---|
| 49 | disable_component_resolution_regex_fallback => 1, |
---|
[3] | 50 | default_view => 'TT', |
---|
[16] | 51 | xmlrpc => { |
---|
| 52 | xml_encoding => 'UTF-8', |
---|
[209] | 53 | show_errors => 1, |
---|
[16] | 54 | }, |
---|
[265] | 55 | 'View::GD' => { |
---|
| 56 | gd_image_type => 'png', # defaults to 'gif' |
---|
| 57 | gd_image_content_type => 'images/png', # defaults to 'image/$gd_image_type' |
---|
| 58 | gd_image_render_args => [ 5 ], # defaults to [] |
---|
| 59 | }, |
---|
[4] | 60 | |
---|
| 61 | 'authentication' => { |
---|
| 62 | default_realm => 'members', |
---|
| 63 | realms => { |
---|
| 64 | members => { |
---|
| 65 | credential => { |
---|
| 66 | class => 'Password', |
---|
| 67 | password_field => 'password', |
---|
[35] | 68 | password_type => 'crypted' |
---|
[4] | 69 | }, |
---|
| 70 | store => { |
---|
[35] | 71 | class => 'DBIx::Class', |
---|
| 72 | user_model => 'Base::Users', |
---|
[65] | 73 | role_relation => 'Roles', |
---|
[35] | 74 | role_field => 'rolename', |
---|
| 75 | id_field => 'mail', |
---|
[65] | 76 | # use_userdata_from_session => 1, |
---|
[4] | 77 | }, |
---|
| 78 | }, |
---|
| 79 | }, |
---|
| 80 | }, |
---|
[1] | 81 | ); |
---|
| 82 | |
---|
[2] | 83 | __PACKAGE__->config->{session} = { |
---|
[124] | 84 | expires => 3600 * 24, # one day |
---|
[42] | 85 | dbi_dbh => 'Session', |
---|
[2] | 86 | dbi_table => 'sessions', |
---|
| 87 | }; |
---|
| 88 | |
---|
[1] | 89 | # Start the application |
---|
| 90 | __PACKAGE__->setup(); |
---|
| 91 | |
---|
| 92 | =head1 NAME |
---|
| 93 | |
---|
| 94 | Sophie - Catalyst based application |
---|
| 95 | |
---|
| 96 | =head1 SYNOPSIS |
---|
| 97 | |
---|
| 98 | script/sophie_server.pl |
---|
| 99 | |
---|
| 100 | =head1 DESCRIPTION |
---|
| 101 | |
---|
| 102 | [enter your description here] |
---|
| 103 | |
---|
| 104 | =head1 SEE ALSO |
---|
| 105 | |
---|
| 106 | L<Sophie::Controller::Root>, L<Catalyst> |
---|
| 107 | |
---|
| 108 | =head1 AUTHOR |
---|
| 109 | |
---|
| 110 | Olivier Thauvin |
---|
| 111 | |
---|
| 112 | =head1 LICENSE |
---|
| 113 | |
---|
| 114 | This library is free software. You can redistribute it and/or modify |
---|
| 115 | it under the same terms as Perl itself. |
---|
| 116 | |
---|
| 117 | =cut |
---|
| 118 | |
---|
| 119 | 1; |
---|