Skip to content

Commit

Permalink
Merge pull request #566 from ayuki-joto/refactor/fix-decidim-map-config
Browse files Browse the repository at this point in the history
refactor: fix map provider params
  • Loading branch information
ayuki-joto authored Oct 10, 2023
2 parents 54b1092 + fa51287 commit ee27f06
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions config/initializers/decidim.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,16 @@
# cache_prefix: "..."
# }
if Rails.application.secrets.maps.present? && Rails.application.secrets.maps[:static_provider].present?
provider = Rails.application.secrets.maps[:provider]
static_provider = Rails.application.secrets.maps[:static_provider]
dynamic_provider = Rails.application.secrets.maps[:dynamic_provider]
dynamic_url = Rails.application.secrets.maps[:dynamic_url]
static_url = Rails.application.secrets.maps[:static_url]
static_url = "https://image.maps.ls.hereapi.com/mia/1.6/mapview" if static_provider == "here" && static_url.blank?
config.maps = {
provider: static_provider,
provider: provider,
api_key: Rails.application.secrets.maps[:static_api_key],
static: { url: static_url },
static: { provider: static_provider, url: static_url },
dynamic: {
provider: dynamic_provider,
api_key: Rails.application.secrets.maps[:dynamic_api_key]
Expand Down
2 changes: 1 addition & 1 deletion config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
workers ENV.fetch("WEB_CONCURRENCY", 2)
workers ENV.fetch("WEB_CONCURRENCY", 2) unless Rails.env.development?

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
Expand Down
1 change: 1 addition & 0 deletions config/secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ default: &default
here_api_key: <%= ENV["GEOCODER_API_KEY"] %>
maps:
api_key: <%= ENV["MAPS_API_KEY"] %>
provider: <%= ENV["MAPS_PROVIDER"] %>
dynamic_provider: <%= Decidim::Env.new("MAPS_DYNAMIC_PROVIDER", ENV["MAPS_PROVIDER"]).to_s %>
static_provider: <%= Decidim::Env.new("MAPS_STATIC_PROVIDER", ENV["MAPS_PROVIDER"]).to_s %>
static_api_key: <%= Decidim::Env.new("MAPS_STATIC_API_KEY", ENV["MAPS_API_KEY"]).to_s %>
Expand Down

0 comments on commit ee27f06

Please sign in to comment.