open-pod/lib/openpod/application.ex

40 lines
1.2 KiB
Elixir
Raw Normal View History

2020-06-08 23:37:11 +02:00
defmodule Openpod.Application do
2020-05-22 22:04:15 +02:00
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
2020-06-07 21:37:41 +02:00
@registry :podcast_registry
@archive_supervisor :archive_supervisor
2020-05-22 22:04:15 +02:00
use Application
def start(_type, _args) do
children = [
2020-06-07 21:37:41 +02:00
# Start Registry
{Registry, [name: @registry, keys: :unique]},
# Start the dynamic supervisor in order to dynamically start podcast cache
{DynamicSupervisor, [name: @archive_supervisor, strategy: :one_for_one]},
2020-05-22 22:04:15 +02:00
# Start the Telemetry supervisor
2020-06-08 23:37:11 +02:00
OpenpodWeb.Telemetry,
2020-05-22 22:04:15 +02:00
# Start the PubSub system
2020-06-08 23:37:11 +02:00
{Phoenix.PubSub, name: Openpod.PubSub},
2020-05-22 22:04:15 +02:00
# Start the Endpoint (http/https)
2020-06-08 23:37:11 +02:00
OpenpodWeb.Endpoint
# Start a worker by calling: Openpod.Worker.start_link(arg)
# {Openpod.Worker, arg}
2020-05-22 22:04:15 +02:00
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
2020-06-08 23:37:11 +02:00
opts = [strategy: :one_for_one, name: Openpod.Supervisor]
2020-05-22 22:04:15 +02:00
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
def config_change(changed, _new, removed) do
2020-06-08 23:37:11 +02:00
OpenpodWeb.Endpoint.config_change(changed, removed)
2020-05-22 22:04:15 +02:00
:ok
end
end