Environment Variables Details
Environment variables are used to pass configuration information to CLI tools inside the container, such as BASE_URL, AUTH_TOKEN, and other sensitive information.
Setting Methods
MANYOYO supports two methods for setting environment variables:
1. String Form (Command Line)
Use the -e parameter to specify environment variables directly on the command line:
manyoyo run -e "ANTHROPIC_BASE_URL=https://xxxx" -e "ANTHROPIC_AUTH_TOKEN=your-key" -x claudeFeatures:
- Suitable for temporary use or testing
- Supports multiple uses of the
-eparameter - Not suitable for sensitive information (will remain in command history)
2. File Form (Recommended)
Use the --ef parameter to load environment variables from a file:
manyoyo run --ef /abs/path/anthropic_claudecode.env -x claudeFeatures:
- Suitable for long-term use and team collaboration
- Sensitive information does not appear in command history
- Supports version control (exclude
.envfiles) - Supports comments and better organization
Environment File Format
Environment files use the .env format and support the following syntax:
# This is a comment and will be ignored
# Standard format (recommended)
export ANTHROPIC_BASE_URL="https://api.anthropic.com"
export ANTHROPIC_AUTH_TOKEN="sk-xxxxxxxx"
# Simplified format (also supported)
API_TIMEOUT_MS=3000000
ANTHROPIC_MODEL="claude-sonnet-4-5"
# Both single and double quotes are supported
TESTPATH='/usr/local/bin'
MESSAGE="Hello World"
# Comments can be placed anywhere
# export DISABLED_VAR="will not take effect"Notes:
- Lines starting with
#are ignored - Supports both
KEY=VALUEandexport KEY=VALUEformats - Values can use single quotes, double quotes, or no quotes
- Empty lines are ignored
Environment File Path Rules
--ef accepts absolute paths only:
manyoyo run --ef /abs/path/myconfig.env
# Loads: file from the specified absolute pathCommon Examples
Claude Code Environment Configuration
Create environment file:
# Create environment file directory (absolute path)
mkdir -p $HOME/.manyoyo/env/
# Create Claude Code environment file
cat > $HOME/.manyoyo/env/anthropic_[claudecode]_claudecode.env << 'EOF'
export ANTHROPIC_BASE_URL="https://api.anthropic.com"
# export CLAUDE_CODE_OAUTH_TOKEN="sk-xxxxxxxx" # OAuth method
export ANTHROPIC_AUTH_TOKEN="sk-xxxxxxxx" # API Key method
export API_TIMEOUT_MS=3000000
export ANTHROPIC_MODEL="claude-sonnet-4-5"
export ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-5"
export ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-5"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5"
export CLAUDE_CODE_SUBAGENT_MODEL="claude-sonnet-4-5"
EOFUse environment file:
# Use from any directory (absolute path)
manyoyo run --ef $HOME/.manyoyo/env/anthropic_[claudecode]_claudecode.env -x claude
# Or use with runs configuration
manyoyo run -r claude # envFile specified in runs.claudeCodex Environment Configuration
Create environment file:
# Create environment file directory (absolute path)
mkdir -p $HOME/.manyoyo/env/
# Create Codex environment file
cat > $HOME/.manyoyo/env/openai_[gpt]_codex.env << 'EOF'
export OPENAI_BASE_URL=https://chatgpt.com/backend-api/codex
EOFUse environment file:
# Use from any directory (absolute path)
manyoyo run --ef $HOME/.manyoyo/env/openai_[gpt]_codex.env -x codex
# Or use with runs configuration
manyoyo run -r codex # envFile specified in runs.codexGemini Environment Configuration
Create environment file:
# Create Gemini environment file
cat > $HOME/.manyoyo/env/gemini.env << 'EOF'
export GEMINI_API_KEY="your-api-key"
export GEMINI_MODEL="gemini-2.0-flash-exp"
EOFUse environment file:
manyoyo run --ef $HOME/.manyoyo/env/gemini.env -x geminiOpenCode Environment Configuration
Create environment file:
# Create OpenCode environment file
cat > $HOME/.manyoyo/env/opencode.env << 'EOF'
export OPENAI_API_KEY="your-api-key"
export OPENAI_BASE_URL="https://api.openai.com/v1"
EOFUse environment file:
manyoyo run --ef $HOME/.manyoyo/env/opencode.env -x opencodeEnvironment Variable Priority
When using configuration files, environment variables are loaded in the following order:
envFilearray in global configurationenvFilearray inruns.<name>- Command-line
--efparameter envmap in global configurationenvmap inruns.<name>- Command-line
-eparameter
Note: Later loaded environment variables will override earlier ones with the same name.
Example:
# Global config: envFile: ["/abs/path/base.env"]
# runs.claude: envFile: ["/abs/path/override.env"]
# Command line: --ef /abs/path/custom.env -e "VAR=value"
#
# Loading order:
# 1. /abs/path/base.env
# 2. /abs/path/override.env
# 3. /abs/path/custom.env
# 4. env map from global config
# 5. env map from runs.claude
# 6. VAR=value from command lineMANYOYO Runtime Environment Variables
Besides container env / envFile, MANYOYO also supports runtime env vars for web authentication:
MANYOYO_SERVER_USERMANYOYO_SERVER_PASS
These are used by serve auth and are not injected into container workloads. See:
Best Practices
1. Use Naming Conventions
Recommended using descriptive file names:
/abs/path/env/
├── anthropic_[claudecode]_claudecode.env
├── openai_[gpt]_codex.env
├── gemini_production.env
└── opencode_dev.env2. Separate Sensitive Information
Store sensitive information (such as API Keys) separately:
# base.env - Non-sensitive configuration
export ANTHROPIC_BASE_URL="https://api.anthropic.com"
export API_TIMEOUT_MS=3000000
# secrets.env - Sensitive information (do not commit to version control)
export ANTHROPIC_AUTH_TOKEN="sk-xxxxxxxx"3. Use Configuration Files for Management
Configure environment files in runs to avoid repetitive input:
// ~/.manyoyo/manyoyo.json (fragment)
{
"runs": {
"claude": {
"envFile": [
"/abs/path/anthropic_base.env",
"/abs/path/anthropic_secrets.env"
]
}
}
}4. Verify Environment Variables
Use debugging commands to verify that environment variables are loaded correctly:
# View final configuration
manyoyo config show -r claude
# Verify in container
manyoyo run -r claude -x env | grep ANTHROPICTroubleshooting
Environment Variables Not Taking Effect
Symptom: CLI tool reports missing required environment variables
Solutions:
- Check file format (must be
.envformat) - Confirm file path is correct
- Use
config showto view configuration - Run
envcommand in container to check
# Check configuration
manyoyo config show --ef /abs/path/myconfig.env
# Check environment variables in container
manyoyo run --ef /abs/path/myconfig.env -x envEnvironment Variable Value Incorrect
Symptom: Environment variable value is not as expected
Solutions:
- Check if multiple configuration sources set the same variable
- Confirm priority order
- Check for duplicate definitions in files
# View all effective environment variables
manyoyo run --ef /abs/path/myconfig.env -x 'env | sort'Related Documentation
- Configuration System Overview - Understand configuration priority mechanism
- Configuration Files Details - Learn how to use envFile in configuration files
- Configuration Examples - View complete configuration examples