Skip to content

Add structured env management with TOML config and justfile#20

Draft
gyorgybalazsi wants to merge 4 commits intomainfrom
george-learning-cbtc
Draft

Add structured env management with TOML config and justfile#20
gyorgybalazsi wants to merge 4 commits intomainfrom
george-learning-cbtc

Conversation

@gyorgybalazsi
Copy link

@gyorgybalazsi gyorgybalazsi commented Feb 26, 2026

Summary

  • Replace comment/uncomment .env workflow with structured environments.toml config (per-environment + per-credential profiles)
  • Add env.nu nushell script that generates .env by merging shared + environment + credential settings
  • Add justfile with recipes for all examples, including auth-type guards that prevent running with wrong credential profile
  • OWNER_FILTER removed from credential profiles — now passed as optional runtime arg to list-deposits-cc
  • Add environments.example.toml as safe-to-commit template with placeholder values

Usage

just envs                              # list available profiles
just env mainnet attestor              # switch to mainnet + attestor credentials
just env mainnet trader                # switch to mainnet + trader credentials
just check-balance                     # run example (guards check auth type)
just list-deposits-cc                  # list all deposit addresses
just list-deposits-cc elk-Validator-2  # filtered by owner
just run <any_example_name>            # run any example directly (no guard)

Auth guards automatically check the .env has the right credential type:

  • Password-grant recipes (most examples) require KEYCLOAK_USERNAME
  • Client-credentials recipes (list-deposits-cc) require KEYCLOAK_CLIENT_SECRET

Test plan

  • nu env.nu lists all environments and credentials
  • nu env.nu mainnet attestor generates correct .env
  • Auth guards block wrong credential type with helpful error message
  • just list-deposits-cc works with and without owner filter param
  • Error cases (bad env, bad credential, missing credential) show clear messages
  • environments.toml no longer contains OWNER_FILTER in any credential profile

🤖 Generated with Claude Code

- Add list_deposit_addresses_client_credential example using client_credentials
  grant type with optional OWNER_FILTER for post-query filtering
- Reorganize .env.example into toggleable environment blocks (devnet/testnet/mainnet)
  with both password and client credentials auth flows documented

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gyorgybalazsi gyorgybalazsi marked this pull request as draft February 26, 2026 10:08
Replace comment/uncomment workflow in .env with a structured
environments.toml config file and a nushell script (env.nu) that
generates .env from selected environment + credential profiles.
Add justfile with recipes for all examples, including auth guards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gyorgybalazsi gyorgybalazsi changed the title Add client credentials example and reorganize .env.example Add structured env management with TOML config and justfile Feb 26, 2026
gyorgybalazsi and others added 2 commits February 26, 2026 15:24
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
These files are now handled via local .git/info/exclude instead.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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