Skip to content

Add env-vars command listing supported environment variables - #776

Open
evgeny-stakewise wants to merge 2 commits into
masterfrom
env-vars-command
Open

Add env-vars command listing supported environment variables#776
evgeny-stakewise wants to merge 2 commits into
masterfrom
env-vars-command

Conversation

@evgeny-stakewise

@evgeny-stakewise evgeny-stakewise commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Problem

The operator recognizes two disjoint sets of environment variables. 49 of them back a CLI option via envvar= and are already documented in --help. The other 41 are read directly through decouple.config and are documented nowhere: not in --help, not on the docs site. Operators have no way to discover them short of reading src/config/settings.py.

This came up in #775, where the reporter proposed adding a new EVENTS_BLOCKS_RANGE_MAX variable without knowing that EVENTS_BLOCKS_RANGE_INTERVAL already does exactly that.

Solution

Make that second set self-documenting, and expose it through a new env-vars command.

src/config/env_vars.py wraps decouple.config with a shim that records each variable's name, group, description, default and cast in a registry, then delegates to decouple unchanged. All 41 call sites in settings.py now pass group= and description=; nothing about value resolution changes.

$ operator env-vars

Execution node
  EVENTS_BLOCKS_RANGE_INTERVAL (int)
    Block range size of a single eth_getLogs query. Lower it when the RPC
    provider rejects the range as too large.
    Default: 12 hours of blocks (3600 on mainnet, 8640 on gnosis)
  EVENTS_CONCURRENCY_LIMIT (int)
    Number of eth_getLogs queries sent in parallel when scanning contract
    logs. Lower it to reduce the load on rate limited RPC providers.
    Default: 10

--format markdown emits per-group tables for the docs site, so published documentation is generated from the same source of truth.

Two tests fail CI if a future decouple_config call omits a description or a group, naming the offending variable. That is what keeps this from drifting back to undocumented.

Notes

  • env-vars deliberately covers only the 41 env-only variables. The CLI-backed ones stay in --help, where they already are. Merging both listings into one view is possible later by walking the click command tree, but it would mean two sources of truth for the same output.
  • The command populates the registry by calling Settings.set() with a placeholder vault and network, because 25 of the 41 variables are read inside that method. The placeholder network is fine since the variables are network agnostic, with one exception: EVENTS_BLOCKS_RANGE_INTERVAL derives its default from SECONDS_PER_BLOCK, so it declares an explicit default_repr naming both values rather than resolving to a mainnet-only number.
  • Defaults computed from the vault directory (KEYSTORES_PASSWORD_DIR) likewise use default_repr so the output does not leak a temp path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant