mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 01:31:39 -05:00
Implement support for custom Photon API host
This commit is contained in:
parent
04a2150959
commit
39bc6aa58a
6 changed files with 23 additions and 14 deletions
|
|
@ -1 +1 @@
|
||||||
0.9.8
|
0.9.10
|
||||||
|
|
|
||||||
|
|
@ -4,3 +4,4 @@ DATABASE_PASSWORD=password
|
||||||
DATABASE_NAME=dawarich_development
|
DATABASE_NAME=dawarich_development
|
||||||
DATABASE_PORT=5432
|
DATABASE_PORT=5432
|
||||||
REDIS_URL=redis://localhost:6379/1
|
REDIS_URL=redis://localhost:6379/1
|
||||||
|
PHOTON_API_HOST='photon.komoot.io'
|
||||||
|
|
|
||||||
|
|
@ -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/)
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
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
|
## [0.9.9] — 2024-07-30
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,22 +11,22 @@ class OwnTracks::Params
|
||||||
{
|
{
|
||||||
latitude: params[:lat],
|
latitude: params[:lat],
|
||||||
longitude: params[:lon],
|
longitude: params[:lon],
|
||||||
battery_status: battery_status,
|
|
||||||
battery: params[:batt],
|
battery: params[:batt],
|
||||||
ping: params[:p],
|
ping: params[:p],
|
||||||
altitude: params[:alt],
|
altitude: params[:alt],
|
||||||
accuracy: params[:acc],
|
accuracy: params[:acc],
|
||||||
vertical_accuracy: params[:vac],
|
vertical_accuracy: params[:vac],
|
||||||
velocity: params[:vel],
|
velocity: params[:vel],
|
||||||
connection: connection,
|
|
||||||
ssid: params[:SSID],
|
ssid: params[:SSID],
|
||||||
bssid: params[:BSSID],
|
bssid: params[:BSSID],
|
||||||
trigger: trigger,
|
|
||||||
tracker_id: params[:tid],
|
tracker_id: params[:tid],
|
||||||
timestamp: params[:tst].to_i,
|
timestamp: params[:tst].to_i,
|
||||||
inrids: params[:inrids],
|
inrids: params[:inrids],
|
||||||
in_regions: params[:inregions],
|
in_regions: params[:inregions],
|
||||||
topic: params[:topic],
|
topic: params[:topic],
|
||||||
|
battery_status:,
|
||||||
|
connection:,
|
||||||
|
trigger:,
|
||||||
raw_data: params.deep_stringify_keys
|
raw_data: params.deep_stringify_keys
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,4 @@
|
||||||
|
|
||||||
MIN_MINUTES_SPENT_IN_CITY = ENV.fetch('MIN_MINUTES_SPENT_IN_CITY', 60).to_i
|
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'
|
REVERSE_GEOCODING_ENABLED = ENV.fetch('REVERSE_GEOCODING_ENABLED', 'true') == 'true'
|
||||||
|
PHOTON_API_HOST = ENV.fetch('PHOTON_API_HOST', nil)
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,18 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Geocoder.configure(
|
settings = {
|
||||||
# geocoding service request timeout, in seconds (default 3):
|
timeout: 5,
|
||||||
# timeout: 5,
|
|
||||||
|
|
||||||
# set default units to kilometers:
|
|
||||||
units: :km,
|
units: :km,
|
||||||
|
|
||||||
# caching (see Caching section below for details):
|
|
||||||
cache: Redis.new,
|
cache: Redis.new,
|
||||||
|
always_raise: :all,
|
||||||
cache_options: {
|
cache_options: {
|
||||||
expiration: 1.day # Defaults to `nil`
|
expiration: 1.day
|
||||||
# prefix: "another_key:" # Defaults to `geocoder:`
|
|
||||||
}
|
}
|
||||||
)
|
}
|
||||||
|
|
||||||
|
if defined?(PHOTON_API_HOST)
|
||||||
|
settings[:lookup] = :photon
|
||||||
|
settings[:photon] = { host: PHOTON_API_HOST }
|
||||||
|
end
|
||||||
|
|
||||||
|
Geocoder.configure(settings)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue