forked from AkkomaGang/akkoma
Merge branch 'fix/replace-mix-env' into 'develop'
Replace Mix.env with Pleroma.Config.get(:env) See merge request pleroma/pleroma!1254
This commit is contained in:
commit
d5330ed125
8 changed files with 13 additions and 9 deletions
|
@ -500,6 +500,8 @@
|
||||||
|
|
||||||
config :pleroma, :database, rum_enabled: false
|
config :pleroma, :database, rum_enabled: false
|
||||||
|
|
||||||
|
config :pleroma, :env, Mix.env()
|
||||||
|
|
||||||
config :http_signatures,
|
config :http_signatures,
|
||||||
adapter: Pleroma.Signature
|
adapter: Pleroma.Signature
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ def enabled_hackney_pools do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Mix.env() == :test do
|
if Pleroma.Config.get(:env) == :test do
|
||||||
defp streamer_child, do: []
|
defp streamer_child, do: []
|
||||||
defp chat_child, do: []
|
defp chat_child, do: []
|
||||||
else
|
else
|
||||||
|
|
|
@ -56,14 +56,14 @@ defp csp_string do
|
||||||
connect_src = "connect-src 'self' #{static_url} #{websocket_url}"
|
connect_src = "connect-src 'self' #{static_url} #{websocket_url}"
|
||||||
|
|
||||||
connect_src =
|
connect_src =
|
||||||
if Mix.env() == :dev do
|
if Pleroma.Config.get(:env) == :dev do
|
||||||
connect_src <> " http://localhost:3035/"
|
connect_src <> " http://localhost:3035/"
|
||||||
else
|
else
|
||||||
connect_src
|
connect_src
|
||||||
end
|
end
|
||||||
|
|
||||||
script_src =
|
script_src =
|
||||||
if Mix.env() == :dev do
|
if Pleroma.Config.get(:env) == :dev do
|
||||||
"script-src 'self' 'unsafe-eval'"
|
"script-src 'self' 'unsafe-eval'"
|
||||||
else
|
else
|
||||||
"script-src 'self'"
|
"script-src 'self'"
|
||||||
|
|
|
@ -15,7 +15,9 @@ def init(args) do
|
||||||
|
|
||||||
def start_link do
|
def start_link do
|
||||||
enabled =
|
enabled =
|
||||||
if Mix.env() == :test, do: true, else: Pleroma.Config.get([__MODULE__, :enabled], false)
|
if Pleroma.Config.get(:env) == :test,
|
||||||
|
do: true,
|
||||||
|
else: Pleroma.Config.get([__MODULE__, :enabled], false)
|
||||||
|
|
||||||
if enabled do
|
if enabled do
|
||||||
Logger.info("Starting retry queue")
|
Logger.info("Starting retry queue")
|
||||||
|
@ -219,7 +221,7 @@ def handle_info(unknown, state) do
|
||||||
{:noreply, state}
|
{:noreply, state}
|
||||||
end
|
end
|
||||||
|
|
||||||
if Mix.env() == :test do
|
if Pleroma.Config.get(:env) == :test do
|
||||||
defp growth_function(_retries) do
|
defp growth_function(_retries) do
|
||||||
_shutit = Pleroma.Config.get([__MODULE__, :initial_timeout])
|
_shutit = Pleroma.Config.get([__MODULE__, :initial_timeout])
|
||||||
DateTime.to_unix(DateTime.utc_now()) - 1
|
DateTime.to_unix(DateTime.utc_now()) - 1
|
||||||
|
|
|
@ -10,7 +10,7 @@ defmodule Pleroma.Web.RelMe do
|
||||||
with_body: true
|
with_body: true
|
||||||
]
|
]
|
||||||
|
|
||||||
if Mix.env() == :test do
|
if Pleroma.Config.get(:env) == :test do
|
||||||
def parse(url) when is_binary(url), do: parse_url(url)
|
def parse(url) when is_binary(url), do: parse_url(url)
|
||||||
else
|
else
|
||||||
def parse(url) when is_binary(url) do
|
def parse(url) when is_binary(url) do
|
||||||
|
|
|
@ -18,7 +18,7 @@ defmodule Pleroma.Web.RichMedia.Parser do
|
||||||
|
|
||||||
def parse(nil), do: {:error, "No URL provided"}
|
def parse(nil), do: {:error, "No URL provided"}
|
||||||
|
|
||||||
if Mix.env() == :test do
|
if Pleroma.Config.get(:env) == :test do
|
||||||
def parse(url), do: parse_url(url)
|
def parse(url), do: parse_url(url)
|
||||||
else
|
else
|
||||||
def parse(url) do
|
def parse(url) do
|
||||||
|
|
|
@ -699,7 +699,7 @@ defmodule Pleroma.Web.Router do
|
||||||
get("/:sig/:url/:filename", MediaProxyController, :remote)
|
get("/:sig/:url/:filename", MediaProxyController, :remote)
|
||||||
end
|
end
|
||||||
|
|
||||||
if Mix.env() == :dev do
|
if Pleroma.Config.get(:env) == :dev do
|
||||||
scope "/dev" do
|
scope "/dev" do
|
||||||
pipe_through([:mailbox_preview])
|
pipe_through([:mailbox_preview])
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ def render("404.json", _assigns) do
|
||||||
def render("500.json", assigns) do
|
def render("500.json", assigns) do
|
||||||
Logger.error("Internal server error: #{inspect(assigns[:reason])}")
|
Logger.error("Internal server error: #{inspect(assigns[:reason])}")
|
||||||
|
|
||||||
if Mix.env() != :prod do
|
if Pleroma.Config.get(:env) != :prod do
|
||||||
%{errors: %{detail: "Internal server error", reason: inspect(assigns[:reason])}}
|
%{errors: %{detail: "Internal server error", reason: inspect(assigns[:reason])}}
|
||||||
else
|
else
|
||||||
%{errors: %{detail: "Internal server error"}}
|
%{errors: %{detail: "Internal server error"}}
|
||||||
|
|
Loading…
Reference in a new issue