Fix geospatial runtime configuration

Geospatial configuration was only evaluated at compile-time, not at
runtime

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-03-16 15:33:44 +01:00
parent ad913eb131
commit 35e641bcff
8 changed files with 43 additions and 35 deletions

View File

@@ -6,13 +6,11 @@ defmodule Mobilizon.Service.Geospatial.Photon do
alias Mobilizon.Addresses.Address
alias Mobilizon.Service.Geospatial.Provider
alias Mobilizon.Service.HTTP.GeospatialClient
import Mobilizon.Service.Geospatial.Provider, only: [endpoint: 1]
require Logger
@behaviour Provider
@endpoint Application.get_env(:mobilizon, __MODULE__) |> get_in([:endpoint])
@impl Provider
@doc """
Photon implementation for `c:Mobilizon.Service.Geospatial.Provider.geocode/3`.
@@ -42,7 +40,7 @@ defmodule Mobilizon.Service.Geospatial.Photon do
limit = Keyword.get(options, :limit, 10)
lang = Keyword.get(options, :lang, "en")
coords = Keyword.get(options, :coords, nil)
endpoint = Keyword.get(options, :endpoint, @endpoint)
endpoint = Keyword.get(options, :endpoint, endpoint(__MODULE__))
case method do
:search ->