aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2012-07-18 20:15:37 +0100
committerMatthew Somerville <matthew@mysociety.org>2012-07-18 20:15:40 +0100
commitcbe5a191b974b28878b14a593601348483618bf7 (patch)
tree4c231c604d25560fee0354181f587b8ce50e1d36
parent069800e2fdf9b130e01774bc208ff9a060b18544 (diff)
Get port for default mapit URL.
-rw-r--r--conf/general.yml-example4
-rw-r--r--perllib/FixMyStreet/App.pm2
2 files changed, 5 insertions, 1 deletions
diff --git a/conf/general.yml-example b/conf/general.yml-example
index e24f0dc80..f2e35451e 100644
--- a/conf/general.yml-example
+++ b/conf/general.yml-example
@@ -36,7 +36,9 @@ GOOGLE_MAPS_API_KEY: ''
BING_MAPS_API_KEY: ''
# Location of MapIt, to map points to administrative areas.
-# If left blank, a default area will be used everywhere.
+# If left blank, a default area will be used everywhere
+# (a URL needs to be given for non-web things, like sending
+# of reports, to function).
MAPIT_URL: ''
# If using the Catalyst development server, set to
# MAPIT_URL: 'http://localhost:3000/fakemapit/'
diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm
index 3096f2f72..b29b922dd 100644
--- a/perllib/FixMyStreet/App.pm
+++ b/perllib/FixMyStreet/App.pm
@@ -183,6 +183,8 @@ sub setup_request {
FixMyStreet::Map::set_map_class( $cobrand->map_type || $c->req->param('map_override') );
unless ( FixMyStreet->config('MAPIT_URL') ) {
+ my $port = $c->req->uri->port;
+ $host = "$host:$port" unless $port == 80;
mySociety::MaPit::configure( "http://$host/fakemapit/" );
}