defmodule Frajtano do use Application @impl true def start(_type, _args) do Frajtano.Supervisor.start_link(name: Frajtano.Supervisor) end end defmodule Frajtano.Supervisor do use Supervisor def start_link(opts) do Supervisor.start_link(__MODULE__, :ok, opts) end @impl true def init(:ok) do children = [ {DynamicSupervisor, name: Frajtano.PeerSupervisor}, {Registry, keys: :unique, name: Frajtano.Peers}, Frajtano.Agent, {Task.Supervisor, name: Frajtano.ClientSupervisor}, {Frajtano.Listener, [Application.fetch_env!(:frajtano, :listen_path)]}, {Task, &Frajtano.Agent.initial_peers/0}, :systemd.ready(), ] Supervisor.init(children, strategy: :one_for_one) end end