defmodule GeoTherminator.Application do # See https://hexdocs.pm/elixir/Application.html # for more information on OTP Applications @moduledoc false use Application @impl true def start(_type, _args) do auth_username = Application.get_env(:geo_therminator, :api_username) auth_password = Application.get_env(:geo_therminator, :api_password) children = [ {Finch, name: GeoTherminator.PumpAPI.HTTP}, {Phoenix.PubSub, name: GeoTherminator.PumpAPI.Device.PubSub}, {Registry, keys: :unique, name: GeoTherminator.PumpAPI.Device.Registry}, {DynamicSupervisor, strategy: :one_for_one, name: GeoTherminator.PumpAPI.Device.Supervisor}, {GeoTherminator.PumpAPI.Auth.Server, %GeoTherminator.PumpAPI.Auth.Server.Options{ server_name: GeoTherminator.PumpAPI.Auth.Server, username: auth_username, password: auth_password }}, # Start the Telemetry supervisor GeoTherminatorWeb.Telemetry, # Start the PubSub system Supervisor.child_spec({Phoenix.PubSub, name: GeoTherminator.PubSub}, id: :phoenix_pubsub), # Start the Endpoint (http/https) GeoTherminatorWeb.Endpoint ] # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options opts = [strategy: :one_for_one, name: GeoTherminator.Supervisor] Supervisor.start_link(children, opts) end # Tell Phoenix to update the endpoint configuration # whenever the application is updated. @impl true def config_change(changed, _new, removed) do GeoTherminatorWeb.Endpoint.config_change(changed, removed) :ok end end