elstat/lib/supervisor.ex

28 lines
610 B
Elixir

defmodule Elstat.Supervisor do
use Supervisor
require Logger
def start_link(opts) do
Supervisor.start_link(__MODULE__, :ok, opts)
end
def init(:ok) do
Logger.info "starting sup"
base_children = [
%{
id: Elstat.Cowboy,
start: {Elstat.Cowboy, :start_link, []},
},
{Sqlitex.Server, ['elstat.db', [name: Sqlitex.Server]]}
]
service_children = Elstat.Manager.build_services()
children = service_children ++ base_children
Logger.debug "final children #{inspect children}"
Supervisor.init(children, strategy: :one_for_one)
end
end