- defp chat_child do
- if Pleroma.Config.get([:chat, :enabled]) do
- [
- %{
- id: Pleroma.Web.ChatChannel.ChatChannelState,
- start: {Pleroma.Web.ChatChannel.ChatChannelState, :start_link, []}
- }
- ]
- else
- []
- end
- end
+ defp idempotency_expiration,
+ do: expiration(default: :timer.seconds(6 * 60 * 60), interval: :timer.seconds(60))
+
+ defp seconds_valid_interval,
+ do: :timer.seconds(Pleroma.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: Pleroma.Config.get([:chat, :enabled])
+
+ defp oauth_cleanup_enabled?,
+ do: Pleroma.Config.get([:oauth2, :clean_expired_tokens], false)
+
+ defp streamer_child(:test), do: []
+
+ defp streamer_child(_) do
+ [Pleroma.Web.Streamer.supervisor()]
+ end
+
+ defp oauth_cleanup_child(true),
+ do: [Pleroma.Web.OAuth.Token.CleanWorker]
+
+ defp oauth_cleanup_child(_), do: []
+
+ defp chat_child(:test, _), do: []
+
+ defp chat_child(_env, true) do
+ [Pleroma.Web.ChatChannel.ChatChannelState]