Add env-vars command listing supported environment variables - #776
Open
evgeny-stakewise wants to merge 2 commits into
Open
Add env-vars command listing supported environment variables#776evgeny-stakewise wants to merge 2 commits into
evgeny-stakewise wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 throughdecouple.configand are documented nowhere: not in--help, not on the docs site. Operators have no way to discover them short of readingsrc/config/settings.py.This came up in #775, where the reporter proposed adding a new
EVENTS_BLOCKS_RANGE_MAXvariable without knowing thatEVENTS_BLOCKS_RANGE_INTERVALalready does exactly that.Solution
Make that second set self-documenting, and expose it through a new
env-varscommand.src/config/env_vars.pywrapsdecouple.configwith 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 insettings.pynow passgroup=anddescription=; nothing about value resolution changes.--format markdownemits 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_configcall omits a description or a group, naming the offending variable. That is what keeps this from drifting back to undocumented.Notes
env-varsdeliberately 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.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_INTERVALderives its default fromSECONDS_PER_BLOCK, so it declares an explicitdefault_reprnaming both values rather than resolving to a mainnet-only number.KEYSTORES_PASSWORD_DIR) likewise usedefault_reprso the output does not leak a temp path.