Configuration

View Source

Browser features

Some features require injecting JS into the debugged application. They are enabled by default, but you can disable them in your config.

# config/dev.exs

# Disables all browser features and does not inject LiveDebugger JS
config :live_debugger, :browser_features?, false

# Used when LiveDebugger's assets are exposed on other address (e.g. when run inside Docker)
config :live_debugger, :external_url, "http://localhost:9007"

Content Security Policy

In router.ex of your Phoenix app, make sure your locally running Phoenix app can access the LiveDebugger JS files on port 4007. To achieve that you may need to extend your CSP in :dev mode:

  @csp "{...your CSP} #{if Mix.env() == :dev, do: "http://127.0.0.1:4007"}"

  pipeline :browser do
    # ...
    plug :put_secure_browser_headers, %{"content-security-policy" => @csp}

Update checks

LiveDebugger comes with optional update checks that inform about newer versions when the debugger interface loads. By default, this feature is enabled and will fetch version information, displaying a notification popup if a newer version is available. You can disable this feature by setting :update_checks? to false in your configuration:

# config/dev.exs

config :live_debugger, :update_checks?, false

Disabling LiveDebugger

In case you need LiveDebugger to not run at the start of your application but want to keep the dependency, you can disable it manually in your config:

# config/dev.exs

config :live_debugger, :disabled?, true

Default Settings

In LiveDebugger, you can set the default values of settings (available in the settings panel) through your application's config. When starting LiveDebugger, settings will always be set to the values defined in the config, but you can still change them temporarily in the settings panel. However, keep in mind that these changes will reset to the config-defined values when you restart the application. This configuration should be used when you want to explicitly force a given behavior of LiveDebugger always in your project. If you want settings to persist across restarts (not reset to config values), you need to remove those entries from your application's config file.

# config/dev.exs

config :live_debugger,
  dead_view_mode: true,
  garbage_collection: true,
  debug_button: false,
  tracing_enabled_on_start: true,
  highlight_in_browser: true

Unix Socket Support

LiveDebugger can listen on a Unix domain socket instead of a TCP ip/port. To do this, set ip to {:local, "/path/to/socket"} and port to 0:

# config/dev.exs

config :live_debugger,
  ip: {:local, "/tmp/live_debugger.sock"},
  port: 0

Note: when using a Unix socket, browser features (debug button, elements inspection) require an :external_url to be set, since the socket path cannot be used as a URL:

config :live_debugger,
  ip: {:local, "/tmp/live_debugger.sock"},
  port: 0,
  external_url: "http://your_external_url"

Other Settings

# config/dev.exs

# LiveDebugger endpoint config
config :live_debugger,
  ip: {127, 0, 0, 1}, # IP on which LiveDebugger will be hosted
  port: 4007, # Port on which LiveDebugger will be hosted
  secret_key_base: "YOUR_SECRET_KEY_BASE", # Secret key used for LiveDebugger.Endpoint
  signing_salt: "your_signing_salt", # Signing salt used for LiveDebugger.Endpoint
  adapter: Bandit.PhoenixAdapter, # Adapter used in LiveDebugger.Endpoint
  server: true, # Forces LiveDebugger to start even if project is not started with the `mix phx.server`
  drainer: [shutdown: 1000] # Wait a maximum of 1000ms before forcefully terminating connections. You can also switch it off with `false`.


# Name for LiveDebugger PubSub (it will create new one so don't put already used name)
config :live_debugger, :pubsub_name, LiveDebugger.CustomPubSub