Skip to content

feat(cli): add -e/--env flag for passing env vars as scrubbed secrets - #132

Draft
sd2k wants to merge 1 commit into
mainfrom
feat/cli-env-vars
Draft

feat(cli): add -e/--env flag for passing env vars as scrubbed secrets#132
sd2k wants to merge 1 commit into
mainfrom
feat/cli-env-vars

Conversation

@sd2k

@sd2k sd2k commented Feb 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds -e KEY=VALUE / -e KEY CLI flags (Docker-style) to pass environment variables into the sandbox
  • Values are passed through the existing secrets API, so they're automatically scrubbed from stdout/stderr/file output
  • -e KEY (without value) inherits from the host environment, errors if not set

Changes

  • _cli.py: New "environment" argument group with -e/--env, new make_secrets() helper
  • __main__.py: Wire make_secrets() into both _run_once() and _repl() paths
  • test_cli.py: 12 new tests (7 unit tests for make_secrets, 5 integration tests for CLI flag)

Example

# Explicit value (scrubbed from output)
eryx -e API_KEY=sk-xxx -c 'import os; print(os.environ["API_KEY"])'
# Output: [REDACTED]

# Inherit from host
export DATABASE_URL=postgres://...
eryx -e DATABASE_URL -c 'import os; print(os.environ["DATABASE_URL"])'
# Output: [REDACTED]

Testing

  • 12 new tests all passing locally
  • All 33 CLI tests pass (21 existing + 12 new)

🤖 Generated with Claude Code

Prior to this commit, there was no way to pass environment variables to
the sandbox via the CLI.

This commit adds Docker-style `-e KEY=VALUE` and `-e KEY` (inherit from
host) flags. Values are passed through the existing secrets API so they
are automatically scrubbed from stdout/stderr/file output.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sd2k
sd2k marked this pull request as ready for review February 10, 2026 17:40
@sd2k
sd2k marked this pull request as draft February 11, 2026 08:42
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