Current section
Files
Jump to
Current section
Files
lib/hanabi.ex
defmodule Hanabi do
import Supervisor.Spec
@moduledoc false
@port Application.get_env :hanabi, :port
def start(), do: start(nil, nil)
def start(_type, _args) do
Supervisor.start_link(__MODULE__, :ok, [])
end
def init(_) do
# Supervisor
children = [
worker(Hanabi.Registry, [:hanabi_users], [restart: :permanent, id: UserRegistry]),
worker(Hanabi.Registry, [:hanabi_channels], [restart: :permanent, id: ChannelRegistry]),
worker(Hanabi.IRC.Handler, [], [restart: :permanent]),
supervisor(Hanabi.IRC.Supervisor, [], [restart: :permanent]),
worker(Task, [Hanabi.IRC.Endpoint, :accept, [@port]], restart: :permanent),
]
supervise(children, strategy: :one_for_one)
end
end