+ defp idempotency_expiration,
+ do: expiration(default: :timer.seconds(6 * 60 * 60), interval: :timer.seconds(60))
+
+ defp seconds_valid_interval,
+ do: :timer.seconds(Config.get!([Pleroma.Captcha, :seconds_valid]))
+
+ defp build_cachex(type, opts),
+ do: %{
+ id: String.to_atom("cachex_" <> type),
+ start: {Cachex, :start_link, [String.to_atom(type <> "_cache"), opts]},
+ type: :worker
+ }
+
+ defp chat_enabled?, do: Config.get([:chat, :enabled])
+
+ defp streamer_child(:test), do: []
+
+ defp streamer_child(_) do
+ [Pleroma.Web.Streamer.supervisor()]
+ end
+
+ defp chat_child(_env, true) do
+ [Pleroma.Web.ChatChannel.ChatChannelState]
+ end
+
+ defp chat_child(_, _), do: []
+
+ defp task_children(:test) do
+ [
+ %{
+ id: :web_push_init,
+ start: {Task, :start_link, [&Pleroma.Web.Push.init/0]},
+ restart: :temporary
+ }
+ ]
+ end
+
+ defp task_children(_) do
+ [
+ %{
+ id: :web_push_init,
+ start: {Task, :start_link, [&Pleroma.Web.Push.init/0]},
+ restart: :temporary
+ },
+ %{
+ id: :internal_fetch_init,
+ start: {Task, :start_link, [&Pleroma.Web.ActivityPub.InternalFetchActor.init/0]},
+ restart: :temporary
+ }
+ ]
+ end
+
+ # start hackney and gun pools in tests
+ defp http_children(_, :test) do
+ hackney_options = Config.get([:hackney_pools, :federation])
+ hackney_pool = :hackney_pool.child_spec(:federation, hackney_options)
+ [hackney_pool, Pleroma.Pool.Supervisor]
+ end
+
+ defp http_children(Tesla.Adapter.Hackney, _) do
+ pools = [:federation, :media]
+
+ pools =
+ if Config.get([Pleroma.Upload, :proxy_remote]) do
+ [:upload | pools]