aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEdmund von der Burg <evdb@mysociety.org>2011-02-22 15:26:35 +0000
committerEdmund von der Burg <evdb@mysociety.org>2011-02-22 15:26:35 +0000
commitc3bcd8b53758e09a3c003cc8afe13064edabd11e (patch)
tree993c2ba4fdf68b04d9f360d185c2d351817eedc1
parent8cd703dbab6847995ca2a0dc51ea7c0f9f486446 (diff)
load config from conf/general into FixMyStreet::App
-rw-r--r--perllib/FixMyStreet/App.pm28
-rw-r--r--setup-dev-environment.bash2
-rw-r--r--t/app/load_general_config.t13
3 files changed, 25 insertions, 18 deletions
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 87c79c3cb..4ec941195 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -2,25 +2,17 @@ package FixMyStreet::App;
use Moose;
use namespace::autoclean;
-use Catalyst::Runtime 5.80;
+BEGIN {
+ use mySociety::Config;
+ mySociety::Config::set_file("conf/general");
+}
-# Set flags and add plugins for the application.
-#
-# Note that ORDERING IS IMPORTANT here as plugins are initialized in order,
-# therefore you almost certainly want to keep ConfigLoader at the head of the
-# list if you're using it.
-#
-# -Debug: activates the debug mode for very useful log messages
-# ConfigLoader: will load the configuration from a Config::General file in the
-# application's home directory
-# Static::Simple: will serve static files from the application's root
-# directory
+use Catalyst::Runtime 5.80;
use Catalyst qw/
- -Debug
- ConfigLoader
- Static::Simple
-/;
+ ConfigLoader
+ Static::Simple
+ /;
extends 'Catalyst';
@@ -36,7 +28,10 @@ our $VERSION = '0.01';
# local deployment.
__PACKAGE__->config(
+ %{ mySociety::Config::get_list() },
+
name => 'FixMyStreet::App',
+
# Disable deprecated behavior needed by old applications
disable_component_resolution_regex_fallback => 1,
);
@@ -44,7 +39,6 @@ __PACKAGE__->config(
# Start the application
__PACKAGE__->setup();
-
=head1 NAME
FixMyStreet::App - Catalyst based application
diff --git a/setup-dev-environment.bash b/setup-dev-environment.bash
index cfac196d4..c5053e2e4 100644
--- a/setup-dev-environment.bash
+++ b/setup-dev-environment.bash
@@ -4,7 +4,7 @@
eval $(perl -Iperllib -Mlocal::lib=local-lib5)
# add the non-standard perllib path to PERL5LIB
-PERL5LIB=perllib:$PERL5LIB
+PERL5LIB=perllib:commonlib/perllib:$PERL5LIB
# put a note in the promp so that we know environment is setup
PS1="(fms) $PS1"
diff --git a/t/app/load_general_config.t b/t/app/load_general_config.t
new file mode 100644
index 000000000..3855c2565
--- /dev/null
+++ b/t/app/load_general_config.t
@@ -0,0 +1,13 @@
+#!/usr/bin/perl -w
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+use_ok 'FixMyStreet::App';
+
+# GAZE_URL chosen as it is unlikely to change
+is FixMyStreet::App->config->{GAZE_URL}, #
+ 'http://gaze.mysociety.org/gaze', #
+ "check that known config param is loaded";