defmodule Runbox.Application do @moduledoc false use Application alias Runbox.Utils.Path, as: PathUtils @impl true def start(type, args) do :ok = set_altworx_root() :ok = check_configuration() case Application.fetch_env!(:runbox, :mode) do :master -> start_master(type, args) :slave -> start_slave(type, args) end end defp set_altworx_root do PathUtils.set_altworx_root(System.get_env("PWD")) end defp check_configuration do Application.fetch_env!(:runbox, :scenario_config_dir) :ok end defp start_master(_type, _args) do children = [] opts = [strategy: :one_for_one, name: Runbox.MasterSup] Supervisor.start_link(children, opts) end defp start_slave(_type, _args) do children = [{Runbox.Scenario.Helper, []}] opts = [strategy: :one_for_one, name: Runbox.SlaveSup] Supervisor.start_link(children, opts) end end