4 SGN - Catalyst-based application to run the SGN website.
12 This is the main class for the Sol Genomics Network main website.
18 use namespace
::autoclean
;
21 $ENV{WEB_PROJECT_NAME
} = $ENV{PROJECT_NAME
} = __PACKAGE__
;
26 use Catalyst
::Runtime
5.80;
30 Does the roles L<SGN::Role::Site::Config>,
31 L<SGN::Role::Site::DBConnector>, L<SGN::Role::Site::DBIC>,
32 L<SGN::Role::Site::Exceptions>, L<SGN::Role::Site::Files>,
33 L<SGN::Role::Site::Mason>, L<SGN::Role::Site::SiteFeatures>,
34 L<SGN::Role::Site::TestMode>
42 +SGN
::Authentication
::Store
44 +SGN
::Role
::Site
::Config
45 +SGN
::Role
::Site
::DBConnector
46 +SGN
::Role
::Site
::DBIC
47 +SGN
::Role
::Site
::Exceptions
48 +SGN
::Role
::Site
::Files
49 +SGN
::Role
::Site
::Mason
50 +SGN
::Role
::Site
::SiteFeatures
51 +SGN
::Role
::Site
::TestMode
60 # configure catalyst-related things. in general, things should not be
61 # added here. add them to SGN.conf, with comments.
67 disable_component_resolution_regex_fallback
=> 1,
69 default_view
=> 'Mason',
71 # Static::Simple configuration
73 dirs
=> [qw
[ css s static img documents static_content data
]],
76 'Plugin::ConfigLoader' => {
79 USERNAME
=> sub { (getpwuid($>))[0] },
81 GROUPNAME
=> sub { (getgrgid($)))[0] },
85 # configure SGN::Role::Site::TestMode. These are the
86 # configuration keys that it will change so that they point into
88 'Plugin::TestMode' => {
89 test_data_dir
=> __PACKAGE__
->path_to('t','data'),
94 cluster_shared_tempdir
99 intron_finder_database
116 'Plugin::Authentication' => {
117 default_realm
=> 'default',
121 class => '+SGN::Authentication::Credentials',
125 class => "+SGN::Authentication::Store",
126 user_class
=> "+SGN::Authentication::User",
127 ### role_column => 'roles',
133 ( $ENV{SGN_TEST_MODE
} ?
( test_mode
=> 1 ) : () ),
137 # on startup, do some dynamic configuration
138 after
'setup_finalize' => sub {
141 $self->config->{basepath
} = $self->config->{home
};
143 # all files written by web server should be group-writable
146 # update the symlinks used to serve static files
147 $self->_update_static_symlinks;
152 sub _update_static_symlinks
{
155 # symlink the static_datasets and
156 # static_content in the root dir so that
157 # Catalyst::Plugin::Static::Simple can serve them. in production,
158 # these will be served directly by Apache
160 # make symlinks for static_content and static_datasets
162 map [ $self->config->{$_.'_path'} =>
163 $self->path_to( $self->config->{root
}, $self->config->{$_.'_url'} )
165 qw( static_content static_datasets );
167 for my $link (@links) {
169 my $l1_rel = $link->[1]->relative( $self->path_to );
170 $self->log->debug("symlinking static dir '$link->[0]' -> '$l1_rel'") if $self->debug;
173 symlink( $link->[0], $link->[1] )
174 or die "$! symlinking $link->[0] => $link->[1]";
180 L<SGN::Controller::Root>, L<Catalyst>
188 This library is free software. You can redistribute it and/or modify
189 it under the same terms as Perl itself.