b9aa3eeb98
This is 'quickly-hacked-together' and needs some love - it's working, but is ways to fragile. It's no more than a POC atm.
23 lines
502 B
Elixir
23 lines
502 B
Elixir
defmodule HAHandler.DRBD.Supervisor do
|
|
use Supervisor
|
|
|
|
alias HAHandler.DRBD.Watcher, as: DRBDWatcher
|
|
|
|
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 ->
|
|
%{
|
|
id: Keyword.get(conf, :hostname),
|
|
start: {DRBDWatcher, :start_link, [conf]}
|
|
}
|
|
end)
|
|
|
|
opts = [strategy: :one_for_one]
|
|
Supervisor.init(children, opts)
|
|
end
|
|
end
|