dawarich/config/initializers/03_dawarich_settings.rb
Aleksei Besogonov 3fe48f6685 Add support for Nominatim
This adds support for Nominatim-based reverse geocoding, along with
Photon and Geofi. To use it, set the environment variables:

NOMINATIM_API_HOST - the host name of the OSM Nominatim server
NOMINATIM_API_USE_HTTPS - use the HTTPS to connect
NOMINATIM_API_KEY - the API key
2025-01-20 23:16:51 -08:00

25 lines
596 B
Ruby

# frozen_string_literal: true
class DawarichSettings
class << self
def reverse_geocoding_enabled?
@reverse_geocoding_enabled ||= photon_enabled? || geoapify_enabled? || nominatim_enabled?
end
def photon_enabled?
@photon_enabled ||= PHOTON_API_HOST.present?
end
def photon_uses_komoot_io?
@photon_uses_komoot_io ||= PHOTON_API_HOST == 'photon.komoot.io'
end
def geoapify_enabled?
@geoapify_enabled ||= GEOAPIFY_API_KEY.present?
end
def nominatim_enabled?
@nominatim_enabled ||= NOMINATIM_API_HOST.present?
end
end
end