Packages
altworx_runbox
11.0.0
25.0.0
24.0.0
23.1.0
23.0.0
22.2.0
22.1.0
22.0.0
21.2.0
21.1.2
21.1.1
21.1.0
21.0.0
20.0.0
19.0.0
18.0.0
17.2.0
17.1.0
17.0.1
17.0.0
16.2.0
16.1.0
16.0.0
15.0.0
14.1.0
14.0.1
14.0.0
13.0.3
13.0.2
13.0.1
13.0.0
12.1.0
12.0.0
11.0.1
11.0.0
10.0.0
9.0.0
8.0.0
7.0.1
7.0.0
6.0.0
5.0.0
4.0.0
3.0.0
2.1.0
2.0.0
1.4.1
1.4.0
1.3.0
1.2.0
1.1.0
1.0.0
0.1.3
0.1.2
0.1.1
0.1.0
Runbox is a library for running Altworx scenarios.
Current section
Files
Jump to
Current section
Files
lib/runbox/application.ex
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
# On master, the altworx root is empty, so it is set to PWD.
#
# On slave, the altworx root is already passed and set explicitly by
# master. Except when the master node runs older runbox and does not pass
# the altworx root. In such case the altworx root is set to PWD.
if is_nil(PathUtils.get_altworx_root()) do
:ok = PathUtils.set_altworx_root(System.get_env("PWD"))
end
:ok
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