Skip to content

Commit

Permalink
Allow CDN URL for the embed page to be configured
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Aug 19, 2020
1 parent c597ead commit 6855616
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/assets/javascripts/embed.js.erb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ window.onload = function () {
args[parts[0]] = decodeURIComponent(parts[1] || '');
}

var mapnikOptions = {
<% if Settings.key?(:tile_cdn_url) %>
url: <%= Settings.tile_cdn_url.to_json %>
<% end %>
};

var thunderforestOptions = {
<% if Settings.key?(:thunderforest_key) %>
apikey: <%= Settings.thunderforest_key.to_json %>
Expand All @@ -30,7 +36,7 @@ window.onload = function () {
map.removeControl(map.attributionControl);

if (!args.layer || args.layer === "mapnik" || args.layer === "osmarender" || args.layer === "mapquest") {
new L.OSM.Mapnik().addTo(map);
new L.OSM.Mapnik(mapnikOptions).addTo(map);
} else if (args.layer === "cyclemap" || args.layer === "cycle map") {
new L.OSM.CycleMap(thunderforestOptions).addTo(map);
} else if (args.layer === "transportmap") {
Expand Down
2 changes: 2 additions & 0 deletions config/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,5 @@ csp_enforce: false
storage_service: "local"
# Root URL for storage service
# storage_url:
# URL for tile CDN
#tile_cdn_url: ""

0 comments on commit 6855616

Please sign in to comment.