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