Skip to content

Commit 34f877e

Browse files
authored
Bug: add config to disable LiveDebugger (#357)
* Added `disabled` option * Updated readme and hex docs * Reverted docs and readme changes * Updated variable name
1 parent a2ce532 commit 34f877e

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

lib/live_debugger.ex

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ defmodule LiveDebugger do
1414
@assets_path "assets/live_debugger/client.js"
1515

1616
def start(_type, _args) do
17+
disabled? = Application.get_env(@app_name, :disabled?, false)
18+
children = if disabled?, do: [], else: get_children()
19+
Supervisor.start_link(children, strategy: :one_for_one, name: LiveDebugger.Supervisor)
20+
end
21+
22+
defp get_children() do
1723
config = Application.get_all_env(@app_name)
1824

1925
put_endpoint_config(config)
@@ -28,18 +34,15 @@ defmodule LiveDebugger do
2834
]}
2935
]
3036

31-
children =
32-
if LiveDebugger.Env.unit_test?() do
33-
children
34-
else
35-
children ++
36-
[
37-
{LiveDebugger.GenServers.CallbackTracingServer, []},
38-
{LiveDebugger.GenServers.EtsTableServer, []}
39-
]
40-
end
41-
42-
Supervisor.start_link(children, strategy: :one_for_one, name: LiveDebugger.Supervisor)
37+
if LiveDebugger.Env.unit_test?() do
38+
children
39+
else
40+
children ++
41+
[
42+
{LiveDebugger.GenServers.CallbackTracingServer, []},
43+
{LiveDebugger.GenServers.EtsTableServer, []}
44+
]
45+
end
4346
end
4447

4548
defp default_adapter() do

0 commit comments

Comments
 (0)