]> git.openstreetmap.org Git - rails.git/commitdiff
Move routing API endpoint addresses to config file
authorTom Hughes <tom@compton.nu>
Mon, 11 Jan 2016 19:03:47 +0000 (19:03 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 11 Jan 2016 19:03:47 +0000 (19:03 +0000)
app/assets/javascripts/index/directions/graphhopper.js
app/assets/javascripts/index/directions/mapquest.js
app/assets/javascripts/index/directions/mapzen.js
app/assets/javascripts/index/directions/osrm.js
app/assets/javascripts/osm.js.erb

index 2d3455eeeda6ac1ca058de6f08bc71fc39c8f67a..c35085b35482fcbf336a7dd76c96522675affbb2 100644 (file)
@@ -21,7 +21,7 @@ function GraphHopperEngine(id, vehicleType) {
       // GraphHopper Directions API documentation
       // https://github.com/graphhopper/directions-api/blob/master/docs-routing.md
       return $.ajax({
-        url: document.location.protocol + "//graphhopper.com/api/1/route",
+        url: document.location.protocol + OSM.GRAPHHOPPER_URL,
         data: {
           vehicle: vehicleType,
           locale: I18n.currentLocale(),
index f46d94dcff92447328a979bf5356a753f76aa5bb..0f645ceeb7f35e621369d080517887f82154595d 100644 (file)
@@ -36,7 +36,7 @@ function MapQuestEngine(id, routeType) {
       var to = points[points.length - 1];
 
       return $.ajax({
-        url: document.location.protocol + "//open.mapquestapi.com/directions/v2/route",
+        url: document.location.protocol + OSM.MAPQUEST_DIRECTIONS_URL,
         data: {
           key: OSM.MAPQUEST_KEY,
           from: from.lat + "," + from.lng,
index 73643ba465faa613da1426b50bbd85df0bc57967..348cb99c99c58367b7611f3b4b318ec5c02f5afe 100644 (file)
@@ -39,7 +39,7 @@ function MapzenEngine(id, costing) {
 
     getRoute: function (points, callback) {
       return $.ajax({
-        url: document.location.protocol + "//valhalla.mapzen.com/route",
+        url: document.location.protocol + OSM.MAPZEN_VALHALLA_URL,
         data: {
           api_key: OSM.MAPZEN_VALHALLA_KEY,
           json: JSON.stringify({
index d9ce0a6b1fe9f0e803e77495ee60104ed395bec3..2ee9da12b1d78dbce1f057d9f706e5d4fa374692 100644 (file)
@@ -51,7 +51,7 @@ function OSRMEngine() {
       }
 
       return $.ajax({
-        url: document.location.protocol + "//router.project-osrm.org/viaroute",
+        url: document.location.protocol + OSM.OSRM_URL,
         data: params,
         dataType: "json",
         success: function (data) {
index 6a8b856bee2beaf155122cfcbb760a47e4931c64..138416be12525fa1fb1480c3e5151f69ffb76daa 100644 (file)
@@ -2,34 +2,38 @@
 
 OSM = {
 <% if defined?(PIWIK) %>
-  PIWIK:                 <%= PIWIK.to_json %>,
+  PIWIK:                   <%= PIWIK.to_json %>,
 <% end %>
 
-  MAX_REQUEST_AREA:      <%= MAX_REQUEST_AREA.to_json %>,
-  SERVER_URL:            <%= SERVER_URL.to_json %>,
-  API_VERSION:           <%= API_VERSION.to_json %>,
-  STATUS:                <%= STATUS.to_json %>,
-  MAX_NOTE_REQUEST_AREA: <%= MAX_NOTE_REQUEST_AREA.to_json %>,
-  OVERPASS_URL:          <%= OVERPASS_URL.to_json %>,
-  NOMINATIM_URL:         <%= NOMINATIM_URL.to_json %>,
+  MAX_REQUEST_AREA:        <%= MAX_REQUEST_AREA.to_json %>,
+  SERVER_URL:              <%= SERVER_URL.to_json %>,
+  API_VERSION:             <%= API_VERSION.to_json %>,
+  STATUS:                  <%= STATUS.to_json %>,
+  MAX_NOTE_REQUEST_AREA:   <%= MAX_NOTE_REQUEST_AREA.to_json %>,
+  OVERPASS_URL:            <%= OVERPASS_URL.to_json %>,
+  NOMINATIM_URL:           <%= NOMINATIM_URL.to_json %>,
+  GRAPHHOPPER_URL:         <%= GRAPHHOPPER_URL.to_json %>,
+  MAPQUEST_DIRECTIONS_URL: <%= MAPQUEST_DIRECTIONS_URL.to_json %>,
+  MAPZEN_VALHALLA_URL:     <%= MAPZEN_VALHALLA_URL.to_json %>,
+  OSRM_URL:                <%= OSRM_URL.to_json %>,
 
 <% if defined?(MAPQUEST_KEY) %>
-  MAPQUEST_KEY:          <%= MAPQUEST_KEY.to_json %>,
+  MAPQUEST_KEY:            <%= MAPQUEST_KEY.to_json %>,
 <% end %>
 <% if defined?(MAPZEN_VALHALLA_KEY) %>
-  MAPZEN_VALHALLA_KEY:   <%= MAPZEN_VALHALLA_KEY.to_json %>,
+  MAPZEN_VALHALLA_KEY:     <%= MAPZEN_VALHALLA_KEY.to_json %>,
 <% end %>
 
-  MARKER_GREEN:          <%= image_path("marker-green.png").to_json %>,
-  MARKER_RED:            <%= image_path("marker-red.png").to_json %>,
+  MARKER_GREEN:            <%= image_path("marker-green.png").to_json %>,
+  MARKER_RED:              <%= image_path("marker-red.png").to_json %>,
 
-  MARKER_ICON:           <%= image_path("images/marker-icon.png").to_json %>,
-  MARKER_ICON_2X:        <%= image_path("images/marker-icon-2x.png").to_json %>,
-  MARKER_SHADOW:         <%= image_path("images/marker-shadow.png").to_json %>,
+  MARKER_ICON:             <%= image_path("images/marker-icon.png").to_json %>,
+  MARKER_ICON_2X:          <%= image_path("images/marker-icon-2x.png").to_json %>,
+  MARKER_SHADOW:           <%= image_path("images/marker-shadow.png").to_json %>,
 
-  NEW_NOTE_MARKER:       <%= image_path("new_note_marker.png").to_json %>,
-  OPEN_NOTE_MARKER:      <%= image_path("open_note_marker.png").to_json %>,
-  CLOSED_NOTE_MARKER:    <%= image_path("closed_note_marker.png").to_json %>,
+  NEW_NOTE_MARKER:         <%= image_path("new_note_marker.png").to_json %>,
+  OPEN_NOTE_MARKER:        <%= image_path("open_note_marker.png").to_json %>,
+  CLOSED_NOTE_MARKER:      <%= image_path("closed_note_marker.png").to_json %>,
 
   apiUrl: function (object) {
     var url = "/api/" + OSM.API_VERSION + "/" + object.type + "/" + object.id;