Skip to content

Commit 93b35b9

Browse files
authored
Task: Add custom LiveDebugger url config (#438)
* add config for managing external url
1 parent c226182 commit 93b35b9

3 files changed

Lines changed: 9 additions & 2 deletions

File tree

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
@@ -81,15 +81,16 @@ defmodule LiveDebugger do
8181
defp put_live_debugger_tags(config) do
8282
ip_string = config |> Keyword.get(:ip, @default_ip) |> :inet.ntoa() |> List.to_string()
8383
port = Keyword.get(config, :port, @default_port)
84+
live_debugger_url = "http://#{ip_string}:#{port}"
8485

8586
browser_features? = Keyword.get(config, :browser_features?, true)
8687
debug_button? = Keyword.get(config, :debug_button?, true)
8788
highlighting? = Keyword.get(config, :highlighting?, true)
8889
version = Application.spec(:live_debugger)[:vsn] |> to_string()
8990
devtools_allow_redirects = Keyword.get(config, :devtools_allow_redirects, false)
91+
external_url = Keyword.get(config, :external_url, live_debugger_url)
9092

91-
live_debugger_url = "http://#{ip_string}:#{port}"
92-
live_debugger_assets_url = "http://#{ip_string}:#{port}/#{@assets_path}"
93+
live_debugger_assets_url = "#{external_url}/#{@assets_path}"
9394

9495
assigns = %{
9596
url: live_debugger_url,

0 commit comments

Comments
 (0)