application.ex 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. defmodule Openpod.Application do
  2. # See https://hexdocs.pm/elixir/Application.html
  3. # for more information on OTP Applications
  4. @moduledoc false
  5. @registry :podcast_registry
  6. @archive_supervisor :archive_supervisor
  7. use Application
  8. def start(_type, _args) do
  9. children = [
  10. # Start Registry
  11. {Registry, [name: @registry, keys: :unique]},
  12. # Start the dynamic supervisor in order to dynamically start podcast cache
  13. {DynamicSupervisor, [name: @archive_supervisor, strategy: :one_for_one]},
  14. # Start the Telemetry supervisor
  15. OpenpodWeb.Telemetry,
  16. # Start the PubSub system
  17. {Phoenix.PubSub, name: Openpod.PubSub},
  18. # Start the Endpoint (http/https)
  19. OpenpodWeb.Endpoint,
  20. # Start a worker by calling: Openpod.Worker.start_link(arg)
  21. # {Openpod.Worker, arg}
  22. Openpod.Boundary.ArchiveScheduler,
  23. ]
  24. # See https://hexdocs.pm/elixir/Supervisor.html
  25. # for other strategies and supported options
  26. opts = [strategy: :one_for_one, name: Openpod.Supervisor]
  27. Supervisor.start_link(children, opts)
  28. end
  29. # Tell Phoenix to update the endpoint configuration
  30. # whenever the application is updated.
  31. def config_change(changed, _new, removed) do
  32. OpenpodWeb.Endpoint.config_change(changed, removed)
  33. :ok
  34. end
  35. end