dawarich/config/initializers/03_dawarich_settings.rb

44 lines
1 KiB
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
class DawarichSettings
2025-05-16 12:51:48 -04:00
BASIC_PAID_PLAN_LIMIT = 10_000_000 # 10 million points
class << self
2025-05-16 12:51:48 -04:00
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
2025-01-15 15:52:59 -05:00
def self_hosted?
@self_hosted ||= SELF_HOSTED
end
2025-02-11 14:45:36 -05:00
def prometheus_exporter_enabled?
@prometheus_exporter_enabled ||=
ENV['PROMETHEUS_EXPORTER_ENABLED'].to_s == 'true' &&
ENV['PROMETHEUS_EXPORTER_HOST'].present? &&
ENV['PROMETHEUS_EXPORTER_PORT'].present?
2025-01-24 06:01:54 -05:00
end
def nominatim_enabled?
@nominatim_enabled ||= NOMINATIM_API_HOST.present?
2025-01-24 06:01:54 -05:00
end
def store_geodata?
@store_geodata ||= STORE_GEODATA
end
end
end