geo-therminator/lib/geo_therminator/application.ex

49 lines
1.6 KiB
Elixir
Raw Normal View History

2021-11-07 09:01:39 +00:00
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
2022-09-13 04:53:42 +00:00
db_dir = Application.get_env(:geo_therminator, :db_dir)
2021-11-07 09:01:39 +00:00
children = [
{CubDB, name: GeoTherminator.DB, data_dir: db_dir},
2021-11-07 09:01:39 +00:00
{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},
{DynamicSupervisor,
strategy: :one_for_one, name: GeoTherminator.PumpAPI.Auth.Server.Supervisor},
2021-11-07 09:01:39 +00:00
# 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)
2022-08-31 17:41:21 +00:00
GeoTherminatorWeb.Endpoint,
{Desktop.Window,
[
app: :geo_therminator,
id: GeoTherminatorWindow,
url: &GeoTherminatorWeb.Endpoint.url/0
]}
2021-11-07 09:01:39 +00:00
]
# 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