From 66de2b159b2e03fcac7fece01d39e1238e02dbf7 Mon Sep 17 00:00:00 2001 From: Alexander Strizhakov Date: Wed, 15 Jan 2020 17:08:45 +0300 Subject: [PATCH] don't migrate Pleroma.Web.EndPoint settings don't set Logger level to all tasks --- lib/mix/pleroma.ex | 7 ++++--- lib/mix/tasks/pleroma/config.ex | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/mix/pleroma.ex b/lib/mix/pleroma.ex index 73a076a53..ea9923440 100644 --- a/lib/mix/pleroma.ex +++ b/lib/mix/pleroma.ex @@ -4,11 +4,12 @@ defmodule Mix.Pleroma do @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) - if Pleroma.Config.get(:env) != :test do - Application.put_env(:logger, :console, level: :debug) + if Pleroma.Config.get(:env) != :test and change_logger_level do + require Logger + Logger.configure(level: :debug) end {:ok, _} = Application.ensure_all_started(:pleroma) diff --git a/lib/mix/tasks/pleroma/config.ex b/lib/mix/tasks/pleroma/config.ex index b69c49b45..92487dd51 100644 --- a/lib/mix/tasks/pleroma/config.ex +++ b/lib/mix/tasks/pleroma/config.ex @@ -27,7 +27,8 @@ defmodule Mix.Tasks.Pleroma.Config 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 Enum.each(@groups, &load_and_create(&1)) @@ -75,7 +76,7 @@ defmodule Mix.Tasks.Pleroma.Config do group |> Application.get_all_env() |> 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) end) |> Enum.each(fn {key, value} -> -- 2.45.2