Configuration File
Create a configuration file (typically namedconfig or .env) with your settings:
config
Production Note: Only
TOKEN_SECRET and GEMINI_API_KEY are required for production. All other settings have optimized defaults.Required Settings
GEMINI_API_KEY
Required: YesDescription: Google Gemini API key for AI features
TOKEN_SECRET
Required: Yes (auto-generated if not provided)Description: Secret key for JWT token signing
Admin User Settings
Self-Hosted Only: Admin user creation is automatic in self-hosted mode. In cloud mode, users authenticate via Google OAuth.
ADMIN_USERNAME
Required: NoDefault:
adminDescription: Admin account username (3-50 characters)
ADMIN_PASSWORD
Required: NoDefault:
VegaAdminDescription: Admin account password (8-64 characters)
RESET_ADMIN_PASSWORD
Required: NoDefault:
falseDescription: Reset admin password on startup if user exists
Cloud Mode Settings
CLOUD_MODE
Required: NoDefault:
falseDescription: Enable cloud-native features
- Google OAuth authentication only
- Multi-tenant data isolation
- Usage quota enforcement
- Shared company reference data
Google OAuth Configuration
Required: Only ifCLOUD_MODE=true
GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET
GOOGLE_CLIENT_REDIRECT_URL
Create OAuth App
Go to Google Cloud Console and create OAuth 2.0 credentials
Development Settings
IS_DEVELOPMENT
Required: NoDefault:
falseDescription: Enable development mode features
- Verbose logging
- Detailed error messages
- CORS allows all origins
- Hot reload enabled (if supported)
Advanced Settings
Database Configuration
DB_CONNECTION_STRING
Required: NoDefault:
/app/data/vega.db?_journal_mode=WAL&_busy_timeout=5000&_foreign_keys=ON&_cache_size=10000&_synchronous=NORMALDescription: SQLite database path and parameters
_journal_mode=WAL: Write-Ahead Logging for better concurrency_busy_timeout=5000: Wait 5 seconds if database is locked_foreign_keys=ON: Enforce referential integrity_cache_size=10000: Cache size in pages (10MB)_synchronous=NORMAL: Balance between safety and speed
The default settings are optimized for most use cases. Only change if you have specific requirements.
Logging
LOG_LEVEL
Required: NoDefault:
info (production), debug (development)Description: Logging verbosity
debug: Verbose logging for troubleshootinginfo: Standard operational logswarn: Warnings and errors onlyerror: Errors only
CORS Configuration
CORS_ALLOWED_ORIGINS
Required: NoDefault:
* (production), localhost (development)Description: Comma-separated list of allowed origins
CORS_ALLOW_CREDENTIALS
Required: NoDefault:
falseDescription: Allow credentials in CORS requests
Cookie Settings
COOKIE_DOMAIN
Required: NoDefault: Auto-detected from request
Description: Cookie domain for session management
COOKIE_SECURE
Required: NoDefault:
true (production), false (development)Description: Require HTTPS for cookies
Token Expiry
ACCESS_TOKEN_EXPIRY
Required: NoDefault:
60 (minutes)Description: JWT access token lifetime
REFRESH_TOKEN_EXPIRY
Required: NoDefault:
72 (hours)Description: JWT refresh token lifetime
Configuration Examples
Minimal Self-Hosted Setup
config
Recommended Self-Hosted Setup
config
Production Self-Hosted Setup
config
Cloud Mode Setup
config
Development Setup
config
Using Docker Secrets
For production deployments, use Docker Secrets for sensitive values:
Supported
_FILE Variables:
GEMINI_API_KEY_FILETOKEN_SECRET_FILEADMIN_PASSWORD_FILEGOOGLE_CLIENT_SECRET_FILE
Environment Variable Loading
Vega AI loads configuration in this order (later sources override earlier ones):- Built-in defaults - Optimized production values
- Environment variables - From shell or Docker
- Config file - Using
--env-fileflag - Docker secrets - Using
_FILEvariables
Docker Run
Docker Compose
Troubleshooting
Configuration Not Loading
Check container logs:Default Credentials Warning
If you see warnings about default credentials:- Verify your config file is being loaded
- Check environment variable names (case-sensitive)
- Ensure no quotes around values in config file
- Restart the container after changes
Invalid API Key
Symptoms:- AI features fail
- “Invalid API key” errors in logs
- Verify key is correct at Google AI Studio
- Check for extra spaces or newlines
- Ensure key starts with
AIza - Verify API is enabled in Google Cloud Console
Security Best Practices
✅ Use strong, randomTOKEN_SECRET (32+ characters)✅ Change default admin password immediately
✅ Use Docker Secrets for sensitive values
✅ Enable HTTPS with
COOKIE_SECURE=true✅ Restrict CORS to specific origins
✅ Keep API keys out of version control
✅ Use
.env files (not checked into git)✅ Regularly update to latest version
✅ Monitor logs for suspicious activity
✅ Backup database regularly
Next Steps
Quickstart
Get Vega AI running in 5 minutes
Cloud vs Self-Hosted
Choose your deployment option