systant/dashboard/lib/dashboard/application.ex
ryan 96de648bca Add real-time MQTT-powered LiveView dashboard
Features:
- MQTT subscriber GenServer connects to mqtt.home
- Real-time host discovery via systant/+/stats topic
- LiveView with Phoenix PubSub for instant updates
- Host cards showing live data and last seen timestamps
- Clean UI with Tailwind styling
- Proper OTP supervision tree

Dashboard ready to receive live data from systant hosts!
Visit /hosts to see real-time monitoring.
2025-08-02 21:57:59 -07:00

36 lines
1.1 KiB
Elixir

defmodule Dashboard.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
children = [
DashboardWeb.Telemetry,
{DNSCluster, query: Application.get_env(:dashboard, :dns_cluster_query) || :ignore},
{Phoenix.PubSub, name: Dashboard.PubSub},
# Start the Finch HTTP client for sending emails
{Finch, name: Dashboard.Finch},
# Start MQTT subscriber for systant hosts
Dashboard.MqttSubscriber,
# Start to serve requests, typically the last entry
DashboardWeb.Endpoint
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Dashboard.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
DashboardWeb.Endpoint.config_change(changed, removed)
:ok
end
end