diff --git a/.app_version b/.app_version index e3e18070..56f31511 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.9.8 +0.9.10 diff --git a/.env.development b/.env.development index 8aeb3141..08a48784 100644 --- a/.env.development +++ b/.env.development @@ -4,3 +4,4 @@ DATABASE_PASSWORD=password DATABASE_NAME=dawarich_development DATABASE_PORT=5432 REDIS_URL=redis://localhost:6379/1 +PHOTON_API_HOST='photon.komoot.io' diff --git a/CHANGELOG.md b/CHANGELOG.md index 50875158..1136f2a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.9.10] — 2024-08-14 + +### Added + +- PHOTON_API_HOST env variable to set the host of the Photon API. It will will allow you to use your own Photon API instance instead of the default one. ## [0.9.9] — 2024-07-30 diff --git a/app/services/own_tracks/params.rb b/app/services/own_tracks/params.rb index b60d6220..d2f40628 100644 --- a/app/services/own_tracks/params.rb +++ b/app/services/own_tracks/params.rb @@ -11,22 +11,22 @@ class OwnTracks::Params { latitude: params[:lat], longitude: params[:lon], - battery_status: battery_status, battery: params[:batt], ping: params[:p], altitude: params[:alt], accuracy: params[:acc], vertical_accuracy: params[:vac], velocity: params[:vel], - connection: connection, ssid: params[:SSID], bssid: params[:BSSID], - trigger: trigger, tracker_id: params[:tid], timestamp: params[:tst].to_i, inrids: params[:inrids], in_regions: params[:inregions], topic: params[:topic], + battery_status:, + connection:, + trigger:, raw_data: params.deep_stringify_keys } end diff --git a/config/initializers/00_constants.rb b/config/initializers/00_constants.rb index 803dd0f1..7251d114 100644 --- a/config/initializers/00_constants.rb +++ b/config/initializers/00_constants.rb @@ -2,3 +2,4 @@ MIN_MINUTES_SPENT_IN_CITY = ENV.fetch('MIN_MINUTES_SPENT_IN_CITY', 60).to_i REVERSE_GEOCODING_ENABLED = ENV.fetch('REVERSE_GEOCODING_ENABLED', 'true') == 'true' +PHOTON_API_HOST = ENV.fetch('PHOTON_API_HOST', nil) diff --git a/config/initializers/geocoder.rb b/config/initializers/geocoder.rb index baa9cf53..5352049e 100644 --- a/config/initializers/geocoder.rb +++ b/config/initializers/geocoder.rb @@ -1,16 +1,18 @@ # frozen_string_literal: true -Geocoder.configure( - # geocoding service request timeout, in seconds (default 3): - # timeout: 5, - - # set default units to kilometers: +settings = { + timeout: 5, units: :km, - - # caching (see Caching section below for details): cache: Redis.new, + always_raise: :all, cache_options: { - expiration: 1.day # Defaults to `nil` - # prefix: "another_key:" # Defaults to `geocoder:` + expiration: 1.day } -) +} + +if defined?(PHOTON_API_HOST) + settings[:lookup] = :photon + settings[:photon] = { host: PHOTON_API_HOST } +end + +Geocoder.configure(settings)