floof/lib/floof/application.ex
2022-11-22 17:35:08 +01:00

25 lines
704 B
Elixir

defmodule Floof.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
port = String.to_integer(System.get_env("FLOOF_PORT") || "2540")
children = [
# Starts a worker by calling: Floof.Worker.start_link(arg)
# {Floof.Worker, arg}
{Task.Supervisor, name: Floof.TaskSupervisor},
{Task, fn -> Floof.accept(port) end}
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Floof.Supervisor]
Supervisor.start_link(children, opts)
end
end