don't migrate Pleroma.Web.EndPoint settings

don't set Logger level to all tasks
This commit is contained in:
Alexander Strizhakov 2020-01-15 17:08:45 +03:00
parent a9c7cd341b
commit 66de2b159b
No known key found for this signature in database
GPG Key ID: 022896A53AEF1381
2 changed files with 7 additions and 5 deletions

View File

@ -4,11 +4,12 @@
defmodule Mix.Pleroma do defmodule Mix.Pleroma do
@doc "Common functions to be reused in mix tasks" @doc "Common functions to be reused in mix tasks"
def start_pleroma do def start_pleroma(change_logger_level \\ true) do
Application.put_env(:phoenix, :serve_endpoints, false, persistent: true) Application.put_env(:phoenix, :serve_endpoints, false, persistent: true)
if Pleroma.Config.get(:env) != :test do if Pleroma.Config.get(:env) != :test and change_logger_level do
Application.put_env(:logger, :console, level: :debug) require Logger
Logger.configure(level: :debug)
end end
{:ok, _} = Application.ensure_all_started(:pleroma) {:ok, _} = Application.ensure_all_started(:pleroma)

View File

@ -27,7 +27,8 @@ defmodule Mix.Tasks.Pleroma.Config do
] ]
def run(["migrate_to_db"]) do def run(["migrate_to_db"]) do
start_pleroma() # we want to save original logger level
start_pleroma(false)
if Pleroma.Config.get([:configurable_from_database]) do if Pleroma.Config.get([:configurable_from_database]) do
Enum.each(@groups, &load_and_create(&1)) Enum.each(@groups, &load_and_create(&1))
@ -75,7 +76,7 @@ defp load_and_create(group) do
group group
|> Application.get_all_env() |> Application.get_all_env()
|> Enum.reject(fn {k, _v} -> |> Enum.reject(fn {k, _v} ->
k in [Pleroma.Repo, :env, :configurable_from_database] or k in [Pleroma.Repo, Pleroma.Web.Endpoint, :env, :configurable_from_database] or
(group == :phoenix and k == :serve_endpoints) (group == :phoenix and k == :serve_endpoints)
end) end)
|> Enum.each(fn {key, value} -> |> Enum.each(fn {key, value} ->