Skip to content

feat(config): per-environment settings with built-in defaults, hidden env switch, rail0 balance - #197

Merged
pviti merged 3 commits into
milestone/nextfrom
feature/per-environment-config
Nov 6, 2026
Merged

pviti merged 3 commits into
milestone/nextfrom
feature/per-environment-config

Conversation

@pviti

@pviti pviti commented Nov 6, 2026

Copy link
Copy Markdown
Member

What changes

Config file: environment + per-environment settings. config.yaml now holds environment: (the active one; absent = production) and environments.<name>.<key> blocks. config set / get / unset work on the active environment for base-url, admin-url, chain, token (and the legacy chain-id); output and http-timeout stay global in settings. Resolution: flag > env var > config file > the environment's built-in default.

Built-in defaults in every environment. base-url, chain (arc) and token (USDC) are defaulted on development, staging and production, so a payment command needs neither -c nor -t out of the box. rail0 config lists them with origin <env> default; config unset returns to the default.

env is hidden. It only records the chosen environment (remembered for every later command), no longer clears settings or revokes the session of the gateway it leaves (sessions are per gateway and stay cached), and is left out of rail0 --help, completion, the generated reference and the README. rail0 env --help and the command keep working.

rail0 balance replaces keys balance (same flags and behaviour), listed under "Network catalog".

Breaking

  • settings.base-url / chain / chain-id / token / admin-url in an existing config.yaml are no longer read (no migration, by decision: the CLI has no external users yet). Move them under environments.<name> or just config set them again.
  • rail0 keys balance is gone; use rail0 balance.

Verification

go build, go vet, go test ./... green; docs/ regenerated (env pages removed, balance page added); smoke-tested against a converted local config (env current -d, config, env -d, balance --help).

🤖 Generated with Claude Code

… env switch, rail0 balance

The config file now records the active environment (production when absent)
and a block of settings per environment; `config set/get/unset` work on the
active one, and base-url, chain and token have built-in defaults in every
environment (production: api.rail0.xyz, arc, USDC), so no payment command
needs -c/-t. `env <name>` only records the choice, keeps every session, and is
hidden from help, completion, docs and README; `env --help` still answers.
`keys balance` becomes the top-level `rail0 balance`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@pviti pviti added this to the Next release milestone Nov 6, 2026
@pviti
pviti changed the base branch from main to release/next November 6, 2026 09:32
@pviti
pviti marked this pull request as ready for review November 6, 2026 10:04
pviti added 2 commits November 6, 2026 11:04
# Conflicts:
#	README.md
#	cmd/balance.go
#	cmd/env.go
#	cmd/env_test.go
#	docs/cli/rail0_env.md
#	docs/man/rail0-env.1
#	docs/man/rail0.1
@pviti
pviti merged commit 4b73846 into milestone/next Nov 6, 2026
1 check passed
@pviti
pviti deleted the feature/per-environment-config branch November 6, 2026 10:07
pviti added a commit that referenced this pull request Nov 6, 2026
The "Next release" milestone: every pull request merged into
`milestone/next` ships with this release. Version and notes are written
by `bin/release-prepare`, run on `milestone/next`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- release:start -->
## rail0 CLI v1.9.0

<!-- release-notes:start -->
### Added

- **config:** per-environment settings with built-in defaults, hidden
env switch, rail0 balance (#197)
- production defaults to Arc and USDC, Arc balances in both scales,
payouts commands hidden (#195)

### Fixed

- **keys:** balance names the gas coin of a chain the gateway does not
list (#194)

**Full diff:**
v1.8.2...v1.9.0
<!-- release-notes:end -->

---

**Version:** **minor**, computed from the pull requests merged since
v1.8.2 (a breaking change → major, `feat` → minor, anything else →
patch). Decided by:

- feat(config): per-environment settings with built-in defaults, hidden
env switch, rail0 balance (#197)
- feat: production defaults to Arc and USDC, Arc balances in both
scales, payouts commands hidden (#195)


Merging this pull request also releases **v1.9.0**: its changes and the
version bump
ship together, under the one approval. On the push to `main`,
`.github/workflows/release.yml` re-runs CI on the merge commit, creates
the tag, and GoReleaser builds the binaries and publishes the GitHub
release, and
posts the release to Slack.

The release notes are the text between the `release-notes` markers
above, read from this
pull request when it merges: edit them here, before merging.

_Opened by `bin/release-prepare`._
<!-- release:end -->
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