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

@@ -10,13 +10,11 @@ defmodule Mobilizon.Service.Geospatial.Mimirsbrunn 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 """
Mimirsbrunn implementation for `c:Mobilizon.Service.Geospatial.Provider.geocode/3`.
@@ -43,7 +41,7 @@ defmodule Mobilizon.Service.Geospatial.Mimirsbrunn do
defp build_url(method, args, options) do
limit = Keyword.get(options, :limit, 10)
lang = Keyword.get(options, :lang, "en")
endpoint = Keyword.get(options, :endpoint, @endpoint)
endpoint = Keyword.get(options, :endpoint, endpoint(__MODULE__))
case method do
:search ->