1 | package Epoll; |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use Config::YAML; |
---|
6 | |
---|
7 | use Catalyst::Runtime '5.70'; |
---|
8 | |
---|
9 | # Set flags and add plugins for the application |
---|
10 | # |
---|
11 | # -Debug: activates the debug mode for very useful log messages |
---|
12 | # ConfigLoader: will load the configuration from a YAML file in the |
---|
13 | # application's home directory |
---|
14 | # Static::Simple: will serve static files from the application's root |
---|
15 | # directory |
---|
16 | |
---|
17 | use Catalyst qw/ |
---|
18 | ConfigLoader |
---|
19 | Static::Simple |
---|
20 | Session |
---|
21 | Session::Store::DBI |
---|
22 | Session::State::Cookie |
---|
23 | Prototype |
---|
24 | I18N |
---|
25 | /; |
---|
26 | |
---|
27 | # Configure the application. |
---|
28 | # |
---|
29 | # Note that settings in Vote.yml (or other external |
---|
30 | # configuration file that you set up manually) take precedence |
---|
31 | # over this when using ConfigLoader. Thus configuration |
---|
32 | # details given here can function as a default configuration, |
---|
33 | # with a external configuration file acting as an override for |
---|
34 | # local deployment. |
---|
35 | |
---|
36 | __PACKAGE__->config( name => 'Epoll' ); |
---|
37 | |
---|
38 | # Config file, in tree, else should be in /etc |
---|
39 | |
---|
40 | __PACKAGE__->config( |
---|
41 | 'Plugin::ConfigLoader' => { |
---|
42 | file => -f __PACKAGE__->path_to('epoll.yml') |
---|
43 | ? __PACKAGE__->path_to('epoll.yml') |
---|
44 | : '/etc/epoll.yml', |
---|
45 | }, |
---|
46 | 'Plugin::I18N' => { |
---|
47 | maketext_options => { |
---|
48 | Decode => 0 |
---|
49 | }, |
---|
50 | } |
---|
51 | ); |
---|
52 | |
---|
53 | __PACKAGE__->config->{session} = { |
---|
54 | expires => 3600 * 24 * 60, |
---|
55 | dbi_table => 'sessions', |
---|
56 | dbi_dsn => 'noo', |
---|
57 | }; |
---|
58 | |
---|
59 | |
---|
60 | # Start the application |
---|
61 | __PACKAGE__->setup; |
---|
62 | |
---|
63 | # This is after because db config is in config file |
---|
64 | __PACKAGE__->config->{session}{dbi_dsn} = 'dbi:Pg:' . __PACKAGE__->config->{db}; |
---|
65 | |
---|
66 | =head1 NAME |
---|
67 | |
---|
68 | Vote - Catalyst based application |
---|
69 | |
---|
70 | =head1 SYNOPSIS |
---|
71 | |
---|
72 | script/vote_server.pl |
---|
73 | |
---|
74 | =head1 DESCRIPTION |
---|
75 | |
---|
76 | [enter your description here] |
---|
77 | |
---|
78 | =head1 SEE ALSO |
---|
79 | |
---|
80 | L<Vote::Controller::Root>, L<Catalyst> |
---|
81 | |
---|
82 | =head1 AUTHOR |
---|
83 | |
---|
84 | Thauvin Olivier |
---|
85 | |
---|
86 | =head1 LICENSE |
---|
87 | |
---|
88 | This library is free software, you can redistribute it and/or modify |
---|
89 | it under the same terms as Perl itself or CeCILL. |
---|
90 | |
---|
91 | =cut |
---|
92 | |
---|
93 | 1; |
---|