Fork of Pleroma with site-specific changes and feature branches https://git.pleroma.social/pleroma/pleroma
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.0KB

  1. # Pleroma: A lightweight social networking server
  2. # Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
  3. # SPDX-License-Identifier: AGPL-3.0-only
  4. defmodule Pleroma.Pool.Supervisor do
  5. use Supervisor
  6. alias Pleroma.Config
  7. alias Pleroma.Pool
  8. def start_link(args) do
  9. Supervisor.start_link(__MODULE__, args, name: __MODULE__)
  10. end
  11. def init(_) do
  12. children =
  13. [
  14. %{
  15. id: Pool.Connections,
  16. start:
  17. {Pool.Connections, :start_link, [{:gun_connections, Config.get([:connections_pool])}]}
  18. }
  19. ] ++ pools()
  20. Supervisor.init(children, strategy: :one_for_one)
  21. end
  22. defp pools do
  23. pools = Config.get(:pools)
  24. pools =
  25. if Config.get([Pleroma.Upload, :proxy_remote]) == false do
  26. Keyword.delete(pools, :upload)
  27. else
  28. pools
  29. end
  30. for {pool_name, pool_opts} <- pools do
  31. pool_opts
  32. |> Keyword.put(:id, {Pool, pool_name})
  33. |> Keyword.put(:name, pool_name)
  34. |> Pool.child_spec()
  35. end
  36. end
  37. end