Overview
Junkie uses environment variables for configuration, loaded viapython-dotenv from a .env file or system environment. All configuration is centralized in core/config.py.
Required Variables
These variables are essential for Junkie to function:Database
Model Provider
core/config.py:10-14
Optional Variables
Agent Configuration
core/config.py:17-23
Debug Configuration
core/config.py:21-22
Important: Set DEBUG_MODE=false in production to reduce log verbosity and improve performance.
Tracing Configuration
core/config.py:26-32
See Monitoring for detailed Phoenix setup.
Context Agent Configuration
core/config.py:38-40
MCP Configuration
core/config.py:35
Additional API Keys
core/config.py:14
Environment File Example
Create a.env file in your project root:
Loading Environment Variables
Junkie usespython-dotenv to load variables automatically:
core/config.py:1-4
Secrets Management
Local Development
- Create
.envfile in project root - Add
.envto.gitignore(never commit secrets!) - Share
.env.exampletemplate with team
Production Deployment
Railway
- Go to project settings
- Navigate to “Variables” tab
- Add each environment variable
- Values are encrypted at rest
Docker
Pass variables via: Environment file:GitHub Actions
For CI/CD workflows:- Go to repository → Settings → Secrets
- Add secrets (e.g.,
COOLIFY_WEBHOOK,COOLIFY_TOKEN) - Reference in workflow:
${{ secrets.SECRET_NAME }}
.github/workflows/main.yml:79-80
Best Practices
- Never commit secrets - Use
.gitignorefor.envfiles - Use separate environments - Different keys for dev/staging/prod
- Rotate keys regularly - Update API keys periodically
- Minimal permissions - Use read-only keys where possible
- Audit access - Track who has access to production secrets
Validation
Before deploying, validate your configuration:Troubleshooting
Variables Not Loading
Check.env location:
- Must be in project root (same directory as
main.py) - Or set
DOTENV_PATHto custom location
Database Connection Fails
Verify connection string format:API Key Errors
- Check key format (no extra spaces or quotes)
- Verify key is active in provider dashboard
- Test key with simple API call
- Check rate limits and quotas
Next Steps
- Docker Deployment - Build and run containers
- Railway Deployment - Deploy to Railway
- Monitoring - Set up Phoenix tracing