repo_server/lib/rl_repo/application.ex

24 lines
694 B
Elixir

defmodule RlRepo.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("PORT") || "10002")
children = [
# Starts a worker by calling: RlRepo.Worker.start_link(arg)
# {RlRepo.Worker, arg}
Supervisor.child_spec({Task, fn -> RlRepo.start(port) end}, restart: :permanent)
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: RlRepo.Supervisor]
Supervisor.start_link(children, opts)
end
end