Mix Tasks: Switch to Application.ensure_all_started instead of

Mix.Task.run and ensure serve_endpoints is set to false

In release environments there is no Mix.Task.run and serve_endpoints
must be set to true for the endpoints to start, so we need to ensure it
is set to false before starting Pleroma for executing a mix task.
This commit is contained in:
rinpatch 2019-06-07 12:37:20 +03:00
parent 62cdf701f4
commit bc597d888c

View File

@ -5,7 +5,8 @@
defmodule Mix.Tasks.Pleroma.Common do defmodule Mix.Tasks.Pleroma.Common 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 do
Mix.Task.run("app.start") Application.put_env(:phoenix, :serve_endpoints, false, persistent: true)
{:ok, _} = Application.ensure_all_started(:pleroma)
end end
def get_option(options, opt, prompt, defval \\ nil, defname \\ nil) do def get_option(options, opt, prompt, defval \\ nil, defname \\ nil) do