ha-handler/lib/ha_handler/pgsql/supervisor.ex

18 lines
384 B
Elixir
Raw Normal View History

2022-02-19 10:18:05 +01:00
defmodule HAHandler.PGSQL.Supervisor do
use Supervisor
alias HAHandler.PGSQL.Watcher, as: PGSQLWatcher
def start_link(opts) do
Supervisor.start_link(__MODULE__, opts, name: __MODULE__)
end
@impl true
def init(instances) do
children = Enum.map(instances, fn conf -> {PGSQLWatcher, conf} end)
opts = [ strategy: :one_for_one ]
Supervisor.init(children, opts)
end
end