defmodule OhMyExOhIrcd.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
topologies = Application.get_env(:libcluster, :topologies, [])
children = [
OhMyExOhIrcdWeb.Telemetry,
OhMyExOhIrcd.PromEx,
# The metrics listener, on its own port — see OhMyExOhIrcd.MetricsPlug.
{Bandit, plug: OhMyExOhIrcd.MetricsPlug, scheme: :http, port: 9568},
OhMyExOhIrcd.Repo,
# Runs pending migrations before anything that depends on the schema
# starts (no-op unless `:migrate_on_start` is enabled — see the module).
OhMyExOhIrcd.Release.Migrator,
{DNSCluster, query: Application.get_env(:oh_my_ex_oh_ircd, :dns_cluster_query) || :ignore},
{Phoenix.PubSub, name: OhMyExOhIrcd.PubSub},
{Cluster.Supervisor, [topologies, [name: OhMyExOhIrcd.ClusterSupervisor]]},
OhMyExOhIrcd.IRC.HLC,
OhMyExOhIrcd.IRC.MessageLog,
OhMyExOhIrcd.Cluster.HordeRegistry,
OhMyExOhIrcd.Cluster.HordeSupervisor,
OhMyExOhIrcd.Cluster.NodeListener,
OhMyExOhIrcd.Images.GarbageCollector,
OhMyExOhIrcd.Sightings.Writer,
OhMyExOhIrcd.Sightings.Pruner,
OhMyExOhIrcd.IRC.Services,
OhMyExOhIrcd.IRC.Listener,
endpoint_child(),
OhMyExOhIrcd.IRC.TLSListener
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: OhMyExOhIrcd.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
OhMyExOhIrcdWeb.Endpoint.config_change(changed, removed)
:ok
end
# In :standalone mode wrap the endpoint in `SiteEncrypt.Phoenix.Endpoint`
# so site_encrypt manages ACME cert lifecycle (provision/renew). In
# :kubernetes mode start the endpoint directly — certs come from a
# mounted Secret, no in-process ACME client needed. The branch is
# compile-time so the alternate path's references aren't even
# compiled into the release.
@tls_mode Application.compile_env(:oh_my_ex_oh_ircd, :tls_mode, :standalone)
if @tls_mode == :standalone do
defp endpoint_child,
do: {SiteEncrypt.Phoenix.Endpoint, endpoint: OhMyExOhIrcdWeb.Endpoint}
else
defp endpoint_child, do: OhMyExOhIrcdWeb.Endpoint
end
end
neiam
/oh-my-ex-oh-ircd
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
2.5 KiB · text
History
4b6fe3b