Skip to main content

Module remote_config

Module remote_config 

Source
Expand description

Remote configuration fetching.

Fetches TOML configuration from a remote URL and merges it with the local config. This provides a generic mechanism for centralized configuration management — any server can serve TOML config over HTTP with Bearer auth.

§Configuration

Via config.toml:

[remote_config]
url = "https://example.com/api/devboy-config"
token_key = "remote_config.token"

Via environment variables (take priority over config file):

  • DEVBOY_REMOTE_CONFIG_URL — URL to fetch config from
  • DEVBOY_REMOTE_CONFIG_TOKEN — Bearer token for authentication

§Behavior

  • Remote values override local values (remote wins)
  • If fetch fails, a warning is printed and local config is used unchanged
  • Timeout: 10 seconds
  • Response must be valid TOML that deserializes into Config

Functions§

fetch_and_merge
local_config - The locally loaded configtoken_from_keychain - Optional token resolved from keychain via token_key
redact_url_for_display
Redact a URL for safe display in diagnostic messages: drop userinfo (basic-auth credentials in https://user:pass@host/...) and any query string or fragment. Scheme + host + port + path are preserved.
resolve_url
Fetch remote config and merge it into the provided local config.