Fix depreciated calls of fetch_env!/2 and get_env/2

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2022-09-21 08:53:50 +02:00
parent 655ae4f9a1
commit bbbaa81a6e
10 changed files with 45 additions and 27 deletions

View File

@@ -83,7 +83,7 @@ defmodule Mobilizon.Federation.ActivityPub.Federator do
def enqueue(type, payload, priority \\ 1) do
Logger.debug("enqueue something with type #{inspect(type)}")
if Application.fetch_env!(:mobilizon, :env) == :test do
if Application.compile_env(:mobilizon, :env) == :test do
handle(type, payload)
else
GenServer.cast(__MODULE__, {:enqueue, type, payload, priority})

View File

@@ -205,7 +205,7 @@ defmodule Mobilizon.Federation.WebFinger do
{:ok, String.t()} | {:error, :link_not_found} | {:error, any()}
defp find_webfinger_endpoint(domain) when is_binary(domain) do
Logger.debug("Calling HostMetaClient for #{domain}")
prefix = if Application.fetch_env!(:mobilizon, :env) !== :dev, do: "https", else: "http"
prefix = if Application.compile_env(:mobilizon, :env) !== :dev, do: "https", else: "http"
with {:ok, %Tesla.Env{status: 200, body: body}} <-
HostMetaClient.get("#{prefix}://#{domain}/.well-known/host-meta"),
@@ -229,7 +229,10 @@ defmodule Mobilizon.Federation.WebFinger do
_ ->
Logger.debug("Using default webfinger location")
prefix = if Application.fetch_env!(:mobilizon, :env) !== :dev, do: "https", else: "http"
prefix =
if Application.compile_env(:mobilizon, :env) !== :dev, do: "https", else: "http"
"#{prefix}://#{domain}/.well-known/webfinger?resource=acct:#{actor}"
end
end