application.ex 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. ]
  23. # See https://hexdocs.pm/elixir/Supervisor.html
  24. # for other strategies and supported options
  25. opts = [strategy: :one_for_one, name: Openpod.Supervisor]
  26. Supervisor.start_link(children, opts)
  27. end
  28. # Tell Phoenix to update the endpoint configuration
  29. # whenever the application is updated.
  30. def config_change(changed, _new, removed) do
  31. OpenpodWeb.Endpoint.config_change(changed, removed)
  32. :ok
  33. end
  34. end