keys-env
Zero-leak environment key loader for bash, zsh, and Python game pipelines.
Shared credential-loading utility for bash, zsh, and Python that loads environment variables and service-account paths from a central api.env file while guaranteeing secret values are never printed.
git clone https://github.com/BestRoiMedia/bestroi-game-tools.gitWhy we built it
Every game project used to copy-paste its own key-loading script, risking accidental secret echoes in agent logs or missing variables. keys-env centralizes secret loading with a strict never-print-values contract.
Architecture & how it works
load_keys.sh (for bash/zsh) and keyenv.py (for Python) locate the workspace api.env file relative to the repository root, optionally filter by LOAD_KEYS_ONLY or explicit key lists, export PLAY_SA_KEY and ASC_KEY_FILE paths when present (e.g. AuthKey_XXXXXXXXXX.p8), and log only key names or variable counts to stderr.
Key capabilities
- Loads all or filtered variables from a central api.env in bash, zsh, and Python
- Never prints, logs, or echoes secret values—reports only variable names and counts
- Auto-exports PLAY_SA_KEY and ASC_KEY_FILE paths when credential files exist
- Includes names, check, and selftest subcommands for safe CI/agent verification
Usage example
LOAD_KEYS_ONLY="OPENAI_API_KEY" source ./keys/load_keys.sh
python3 ./keys/keyenv.py names
python3 ./keys/keyenv.py check OPENAI_API_KEY