37 lines
1.1 KiB
Elixir
37 lines
1.1 KiB
Elixir
defmodule Farmbot.System.Supervisor do
|
|
@moduledoc """
|
|
Supervises Platform specific stuff for Farmbot to operate
|
|
"""
|
|
use Supervisor
|
|
import Farmbot.System.Init
|
|
|
|
@doc false
|
|
def start_link(args) do
|
|
Supervisor.start_link(__MODULE__, args, [name: __MODULE__])
|
|
end
|
|
|
|
def init([]) do
|
|
before_init_children = [
|
|
worker(Farmbot.System.Registry, []),
|
|
worker(Farmbot.System.Init.KernelMods, [[], []]),
|
|
worker(Farmbot.System.Init.FSCheckup, [[], []]),
|
|
supervisor(Farmbot.System.Init.Ecto, [[], []]),
|
|
supervisor(Farmbot.System.ConfigStorage, []),
|
|
worker(Farmbot.System.ConfigStorage.Dispatcher, []),
|
|
]
|
|
|
|
init_mods =
|
|
Application.get_env(:farmbot, :init)
|
|
|> Enum.map(fn child -> fb_init(child, [[], [name: child]]) end)
|
|
|
|
after_init_children = [
|
|
supervisor(Farmbot.System.Updates, []),
|
|
worker(Farmbot.EasterEggs, []),
|
|
worker(Farmbot.Logger.NetLogger, [])
|
|
]
|
|
|
|
all_children = before_init_children ++ init_mods ++ after_init_children
|
|
Supervisor.init(all_children, strategy: :one_for_all)
|
|
end
|
|
end
|