Skip to content

Commit b15deac

Browse files
authored
Task: Add custom LiveDebugger url config (#438) (#442)
* add config for managing external url
1 parent 2f483e9 commit b15deac

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ config :live_debugger, :debug_button?, false
8383

8484
# Disables only components highlighting
8585
config :live_debugger, :highlighting?, false
86+
87+
# Used when LiveDebugger's assets are exposed on other address (e.g. when run inside Docker)
88+
config :live_debugger, :external_url, "http://localhost:9007"
8689
```
8790

8891
### Content Security Policy

docs/config.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ config :live_debugger, :debug_button?, false
1313

1414
# Disables only components highlighting
1515
config :live_debugger, :highlighting?, false
16+
17+
# Used when LiveDebugger's assets are exposed on other address (e.g. when run inside Docker)
18+
config :live_debugger, :external_url, "http://localhost:9007"
1619
```
1720

1821
### Content Security Policy

lib/live_debugger.ex

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,14 @@ defmodule LiveDebugger do
8080
defp put_live_debugger_tags(config) do
8181
ip_string = config |> Keyword.get(:ip, @default_ip) |> :inet.ntoa() |> List.to_string()
8282
port = Keyword.get(config, :port, @default_port)
83+
live_debugger_url = "http://#{ip_string}:#{port}"
8384

8485
browser_features? = Keyword.get(config, :browser_features?, true)
8586
debug_button? = Keyword.get(config, :debug_button?, true)
8687
highlighting? = Keyword.get(config, :highlighting?, true)
88+
external_url = Keyword.get(config, :external_url, live_debugger_url)
8789

88-
live_debugger_url = "http://#{ip_string}:#{port}"
89-
live_debugger_assets_url = "http://#{ip_string}:#{port}/#{@assets_path}"
90+
live_debugger_assets_url = "#{external_url}/#{@assets_path}"
9091

9192
assigns = %{
9293
url: live_debugger_url,

0 commit comments

Comments
 (0)