elstat/lib/supervisor.ex

28 lines
610 B
Elixir
Raw Normal View History

2018-06-10 21:56:59 +00:00
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"
2018-06-11 07:24:16 +00:00
base_children = [
2018-06-10 21:56:59 +00:00
%{
id: Elstat.Cowboy,
start: {Elstat.Cowboy, :start_link, []},
2018-06-11 07:24:16 +00:00
},
{Sqlitex.Server, ['elstat.db', [name: Sqlitex.Server]]}
2018-06-10 21:56:59 +00:00
]
2018-06-11 07:24:16 +00:00
service_children = Elstat.Manager.build_services()
children = service_children ++ base_children
Logger.debug "final children #{inspect children}"
2018-06-10 21:56:59 +00:00
Supervisor.init(children, strategy: :one_for_one)
end
end