Standardize the way we capture and use Mix.env()
This commit is contained in:
parent
7b67bf4e97
commit
bf9cd4a0e2
@ -14,7 +14,7 @@ defmodule Pleroma.Application do
|
|||||||
@name Mix.Project.config()[:name]
|
@name Mix.Project.config()[:name]
|
||||||
@version Mix.Project.config()[:version]
|
@version Mix.Project.config()[:version]
|
||||||
@repository Mix.Project.config()[:source_url]
|
@repository Mix.Project.config()[:source_url]
|
||||||
@env Mix.env()
|
@mix_env Mix.env()
|
||||||
|
|
||||||
def name, do: @name
|
def name, do: @name
|
||||||
def version, do: @version
|
def version, do: @version
|
||||||
@ -92,15 +92,15 @@ defmodule Pleroma.Application do
|
|||||||
Pleroma.Web.Plugs.RateLimiter.Supervisor
|
Pleroma.Web.Plugs.RateLimiter.Supervisor
|
||||||
] ++
|
] ++
|
||||||
cachex_children() ++
|
cachex_children() ++
|
||||||
http_children(adapter, @env) ++
|
http_children(adapter, @mix_env) ++
|
||||||
[
|
[
|
||||||
Pleroma.Stats,
|
Pleroma.Stats,
|
||||||
Pleroma.JobQueueMonitor,
|
Pleroma.JobQueueMonitor,
|
||||||
{Majic.Pool, [name: Pleroma.MajicPool, pool_size: Config.get([:majic_pool, :size], 2)]},
|
{Majic.Pool, [name: Pleroma.MajicPool, pool_size: Config.get([:majic_pool, :size], 2)]},
|
||||||
{Oban, Config.get(Oban)}
|
{Oban, Config.get(Oban)}
|
||||||
] ++
|
] ++
|
||||||
task_children(@env) ++
|
task_children(@mix_env) ++
|
||||||
dont_run_in_test(@env) ++
|
dont_run_in_test(@mix_env) ++
|
||||||
chat_child(chat_enabled?()) ++
|
chat_child(chat_enabled?()) ++
|
||||||
[
|
[
|
||||||
Pleroma.Web.Endpoint,
|
Pleroma.Web.Endpoint,
|
||||||
@ -145,7 +145,7 @@ defmodule Pleroma.Application do
|
|||||||
raise "Invalid custom modules"
|
raise "Invalid custom modules"
|
||||||
|
|
||||||
{:ok, modules, _warnings} ->
|
{:ok, modules, _warnings} ->
|
||||||
if @env != :test do
|
if @mix_env != :test do
|
||||||
Enum.each(modules, fn mod ->
|
Enum.each(modules, fn mod ->
|
||||||
Logger.info("Custom module loaded: #{inspect(mod)}")
|
Logger.info("Custom module loaded: #{inspect(mod)}")
|
||||||
end)
|
end)
|
||||||
|
@ -15,6 +15,8 @@ defmodule Pleroma.Emoji.Loader do
|
|||||||
|
|
||||||
require Logger
|
require Logger
|
||||||
|
|
||||||
|
@mix_env Mix.env()
|
||||||
|
|
||||||
@type pattern :: Regex.t() | module() | String.t()
|
@type pattern :: Regex.t() | module() | String.t()
|
||||||
@type patterns :: pattern() | [pattern()]
|
@type patterns :: pattern() | [pattern()]
|
||||||
@type group_patterns :: keyword(patterns())
|
@type group_patterns :: keyword(patterns())
|
||||||
@ -79,7 +81,7 @@ defmodule Pleroma.Emoji.Loader do
|
|||||||
|
|
||||||
# for testing emoji.txt entries we do not want exposed in normal operation
|
# for testing emoji.txt entries we do not want exposed in normal operation
|
||||||
test_emoji =
|
test_emoji =
|
||||||
if Mix.env() == :test do
|
if @mix_env == :test do
|
||||||
load_from_file("test/config/emoji.txt", emoji_groups)
|
load_from_file("test/config/emoji.txt", emoji_groups)
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
defmodule Pleroma.Uploaders.Uploader do
|
defmodule Pleroma.Uploaders.Uploader do
|
||||||
import Pleroma.Web.Gettext
|
import Pleroma.Web.Gettext
|
||||||
|
|
||||||
|
@mix_env Mix.env()
|
||||||
|
|
||||||
@moduledoc """
|
@moduledoc """
|
||||||
Defines the contract to put and get an uploaded file to any backend.
|
Defines the contract to put and get an uploaded file to any backend.
|
||||||
"""
|
"""
|
||||||
@ -74,7 +76,7 @@ defmodule Pleroma.Uploaders.Uploader do
|
|||||||
end
|
end
|
||||||
|
|
||||||
defp callback_timeout do
|
defp callback_timeout do
|
||||||
case Mix.env() do
|
case @mix_env do
|
||||||
:test -> 1_000
|
:test -> 1_000
|
||||||
_ -> 30_000
|
_ -> 30_000
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user