+
+ if Pleroma.Config.get(:env) != :test do
+ Application.put_env(:logger, :console, level: :debug)
+ end
+
+ adapter = Application.get_env(:tesla, :adapter)
+
+ apps =
+ if adapter == Tesla.Adapter.Gun do
+ [:gun | @apps]
+ else
+ [:hackney | @apps]
+ end
+
+ Enum.each(apps, &Application.ensure_all_started/1)
+
+ children =
+ [
+ Pleroma.Repo,
+ {Pleroma.Config.TransferTask, false},
+ Pleroma.Web.Endpoint,
+ {Oban, Pleroma.Config.get(Oban)}
+ ] ++
+ http_children(adapter)
+
+ cachex_children = Enum.map(@cachex_children, &Pleroma.Application.build_cachex(&1, []))
+
+ Supervisor.start_link(children ++ cachex_children,
+ strategy: :one_for_one,
+ name: Pleroma.Supervisor
+ )
+
+ if Pleroma.Config.get(:env) not in [:test, :benchmark] do
+ pleroma_rebooted?()
+ end
+ end
+
+ defp pleroma_rebooted? do
+ if Restarter.Pleroma.rebooted?() do
+ :ok
+ else
+ Process.sleep(10)
+ pleroma_rebooted?()
+ end
+ end
+
+ def load_pleroma do
+ Application.load(:pleroma)