2019-03-05 11:38:25 -07:00
|
|
|
defmodule FarmbotExt.Bootstrap.Supervisor do
|
2019-12-17 15:19:53 -07:00
|
|
|
@moduledoc """
|
2020-03-09 09:59:37 -06:00
|
|
|
Supervisor responsible for starting all
|
2019-12-17 15:19:53 -07:00
|
|
|
the tasks and processes that require authentication.
|
|
|
|
"""
|
2018-07-25 16:08:53 -06:00
|
|
|
use Supervisor
|
|
|
|
|
2019-12-17 15:19:53 -07:00
|
|
|
@doc false
|
2018-07-25 16:08:53 -06:00
|
|
|
def start_link(args) do
|
2018-10-29 10:33:52 -06:00
|
|
|
Supervisor.start_link(__MODULE__, args, name: __MODULE__)
|
2018-07-25 16:08:53 -06:00
|
|
|
end
|
|
|
|
|
2019-12-17 15:19:53 -07:00
|
|
|
@impl Supervisor
|
2018-07-25 16:08:53 -06:00
|
|
|
def init([]) do
|
2020-03-26 15:30:02 -06:00
|
|
|
Supervisor.init(children(), strategy: :one_for_one)
|
|
|
|
end
|
|
|
|
|
|
|
|
def children() do
|
|
|
|
config = Application.get_env(:farmbot_ext, __MODULE__) || []
|
2020-03-26 16:06:55 -06:00
|
|
|
|
2020-03-26 15:30:02 -06:00
|
|
|
Keyword.get(config, :children, [
|
2019-03-05 11:38:25 -07:00
|
|
|
FarmbotExt.API.EagerLoader.Supervisor,
|
|
|
|
FarmbotExt.API.DirtyWorker.Supervisor,
|
|
|
|
FarmbotExt.AMQP.Supervisor,
|
2019-09-09 13:56:08 -06:00
|
|
|
FarmbotExt.API.ImageUploader,
|
|
|
|
FarmbotExt.Bootstrap.DropPasswordTask
|
2020-03-26 15:30:02 -06:00
|
|
|
])
|
2018-07-25 16:08:53 -06:00
|
|
|
end
|
|
|
|
end
|