diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-11-20 21:37:17 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2015-12-02 17:41:42 +0000 |
commit | 23949e52f20020fa56cd54655a487ef97ebbc222 (patch) | |
tree | fd8a58a3b6df905851ecbed5d83919d7d9d88ed1 /perllib/FixMyStreet.pm | |
parent | d48de55d99bd55b28c5aa0fd9f095e9c918b52cb (diff) |
Remove many uses of mySociety::Config.
Diffstat (limited to 'perllib/FixMyStreet.pm')
-rw-r--r-- | perllib/FixMyStreet.pm | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/perllib/FixMyStreet.pm b/perllib/FixMyStreet.pm index 3fc067d3e..1a9c8ff60 100644 --- a/perllib/FixMyStreet.pm +++ b/perllib/FixMyStreet.pm @@ -95,15 +95,12 @@ sub override_config($&) { mySociety::MaPit::configure($config->{MAPIT_URL}) if $config->{MAPIT_URL}; - # For historical reasons, we have two ways of asking for config variables. - # Override them both, I'm sure we'll find time to get rid of one eventually. - # - # NB: though we have these two functions, templates tend to use [% c.config %] + # NB: though we have this, templates tend to use [% c.config %]. # This overriding happens after $c->config is set, so note that # FixMyStreet::App->setup_request rewrites $c->config if we are in # test_mode, so tests should Just Work there too. - my $override_guard1 = Sub::Override->new( + my $override_guard = Sub::Override->new( "FixMyStreet::config", sub { my ($class, $key) = @_; @@ -113,23 +110,12 @@ sub override_config($&) { return $orig_config->{$key} if exists $orig_config->{$key}; } ); - my $override_guard2 = Sub::Override->new( - "mySociety::Config::get", - sub ($;$) { - my ($key, $default) = @_; - return $config->{$key} if exists $config->{$key}; - my $orig_config = mySociety::Config::load_default(); - return $orig_config->{$key} if exists $orig_config->{$key}; - return $default if @_ == 2; - } - ); FixMyStreet::Map::reload_allowed_maps() if $config->{MAP_TYPE}; $code->(); - $override_guard1->restore(); - $override_guard2->restore(); + $override_guard->restore(); mySociety::MaPit::configure() if $config->{MAPIT_URL}; FixMyStreet::Map::reload_allowed_maps() if $config->{MAP_TYPE}; } |