Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix maps configuration #111

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 65 additions & 6 deletions config/initializers/decidim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,72 @@
config.default_locale = Rails.application.secrets.decidim[:default_locale].presence || :en
config.available_locales = Rails.application.secrets.decidim[:available_locales].presence || [:en]

# Geocoder configuration
config.maps = {
provider: :here,
api_key: Rails.application.secrets.maps[:api_key],
static: { url: "https://image.maps.ls.hereapi.com/mia/1.6/mapview" }
}
# Map and Geocoder configuration
#
# == HERE Maps ==
# config.maps = {
# provider: :here,
# api_key: Rails.application.secrets.maps[:api_key],
# static: { url: "https://image.maps.ls.hereapi.com/mia/1.6/mapview" }
# }
#
# == OpenStreetMap (OSM) services ==
# To use the OSM map service providers, you will need a service provider for
# the following map servers or host all of them yourself:
# - A tile server for the dynamic maps
# (https://wiki.openstreetmap.org/wiki/Tile_servers)
# - A Nominatim geocoding server for the geocoding functionality
# (https://wiki.openstreetmap.org/wiki/Nominatim)
# - A static map server for static map images
# (https://github.com/jperelli/osm-static-maps)
#
# When used, please read carefully the terms of service for your service
# provider.
#
# config.maps = {
# provider: :osm,
# api_key: Rails.application.secrets.maps[:api_key],
# dynamic: {
# tile_layer: {
# url: "https://tiles.example.org/{z}/{x}/{y}.png?key={apiKey}&{foo}",
# api_key: true,
# foo: "bar=baz",
# attribution: %(
# <a href="https://www.openstreetmap.org/copyright" target="_blank">&copy; OpenStreetMap</a> contributors
# ).strip
# # Translatable attribution:
# # attribution: -> { I18n.t("tile_layer_attribution") }
# }
# },
# static: { url: "https://staticmap.example.org/" },
# geocoding: { host: "nominatim.example.org", use_https: true }
# }
#
# == Combination (OpenStreetMap default + HERE Maps dynamic map tiles) ==
# config.maps = {
# provider: :osm,
# api_key: Rails.application.secrets.maps[:api_key],
# dynamic: {
# provider: :here,
# api_key: Rails.application.secrets.maps[:here_api_key]
# },
# static: { url: "https://staticmap.example.org/" },
# geocoding: { host: "nominatim.example.org", use_https: true }
# }

# Geocoder configurations if you want to customize the default geocoding
# settings. The maps configuration will manage which geocoding service to use,
# so that does not need any additional configuration here. Use this only for
# the global geocoder preferences.
# config.geocoder = {
# # geocoding service request timeout, in seconds (default 3):
# timeout: 5,
# # set default units to kilometers:
# units: :km,
# # caching (see https://github.com/alexreisner/geocoder#caching for details):
# cache: Redis.new,
# cache_prefix: "..."
# }
if Rails.application.secrets.maps.present? && Rails.application.secrets.maps[:static_provider].present?
static_provider = Rails.application.secrets.maps[:static_provider]
dynamic_provider = Rails.application.secrets.maps[:dynamic_provider]
Expand Down
Loading