Overview
Vega AI can be configured using environment variables. Most settings have sensible defaults and only need to be overridden for specific use cases.Configuration Priority
Vega AI reads configuration in this order (later sources override earlier ones):- Default values (built into application)
- Environment variables
- Environment variables from files (using
_FILEsuffix)
Required Settings
These variables are required for Vega AI to function:GEMINI_API_KEY
- Description: Google Gemini API key for AI features (document generation, job matching, CV parsing)
- Required: Yes
- Default: None
- Example:
GEMINI_API_KEY=AIzaSyB... - Get API Key: Google AI Studio
TOKEN_SECRET
- Description: Secret key for signing JWT tokens (authentication)
- Required: Highly recommended for production
- Default: Auto-generated (not recommended for production)
- Example:
TOKEN_SECRET=your-super-secret-jwt-key-here - Generate:
openssl rand -base64 32
Optional Settings
Admin User Configuration
ADMIN_USERNAME
- Description: Username for the default admin account (created on first startup)
- Default:
admin - Example:
ADMIN_USERNAME=myadmin
ADMIN_PASSWORD
- Description: Password for the default admin account
- Default:
VegaAdmin - Example:
ADMIN_PASSWORD=MySecurePassword123
Change the default password immediately after first login via Settings → Account.
RESET_ADMIN_PASSWORD
- Description: Reset admin password to the value in
ADMIN_PASSWORDon startup - Default:
false - Values:
true,false
Security Settings
COOKIE_SECURE
- Description: Require HTTPS for authentication cookies
- Default:
true(production),false(development) - Values:
true,false - Use Case: Set to
falseonly for local development without HTTPS
COOKIE_DOMAIN
- Description: Domain for authentication cookies
- Default: None (uses request domain)
- Example:
COOKIE_DOMAIN=yourdomain.com - Use Case: Cross-subdomain authentication
ACCESS_TOKEN_EXPIRY
- Description: Access token expiry time in minutes
- Default:
60(1 hour) - Example:
ACCESS_TOKEN_EXPIRY=30
REFRESH_TOKEN_EXPIRY
- Description: Refresh token expiry time in hours
- Default:
72(3 days) - Example:
REFRESH_TOKEN_EXPIRY=168
OAuth Configuration
OAuth settings are only needed if you want to enable Google social login.
GOOGLE_CLIENT_ID
- Description: Google OAuth client ID
- Required: Only for Google OAuth
- Default: None
- Example:
GOOGLE_CLIENT_ID=123456789-abc...apps.googleusercontent.com
GOOGLE_CLIENT_SECRET
- Description: Google OAuth client secret
- Required: Only for Google OAuth
- Default: None
- Example:
GOOGLE_CLIENT_SECRET=GOCSPX-...
GOOGLE_CLIENT_REDIRECT_URL
- Description: OAuth redirect URL for Google authentication
- Default:
http://localhost:8765/auth/google/callback - Example:
GOOGLE_CLIENT_REDIRECT_URL=https://yourdomain.com/auth/google/callback
CORS Configuration
CORS_ALLOWED_ORIGINS
- Description: Comma-separated list of allowed CORS origins
- Default:
*(production),http://localhost:*(development) - Example:
CORS_ALLOWED_ORIGINS=https://app.example.com,https://example.com
Cloud Mode Features
CLOUD_MODE
- Description: Enable cloud-native features (usage quotas, multi-tenancy)
- Default:
false - Values:
true,false - Use Case: Set to
truefor managed cloud deployments
Cloud mode is designed for the hosted version at vega.benidevo.com. Self-hosted users should keep this disabled.
Development Settings
IS_DEVELOPMENT
- Description: Enable development mode (verbose logging, hot reload)
- Default:
false - Values:
true,false
LOG_LEVEL
- Description: Application log level
- Default:
info(production),debug(development) - Values:
debug,info,warn,error
Database Configuration
DB_CONNECTION_STRING
- Description: SQLite database connection string with optimized settings
- Default:
/app/data/vega.db?_journal_mode=WAL&_busy_timeout=5000&_foreign_keys=ON&_cache_size=10000&_synchronous=NORMAL - Example:
/custom/path/vega.db?_journal_mode=WAL&_busy_timeout=5000
File-Based Configuration (Docker Secrets)
Vega AI supports reading sensitive configuration from files using the_FILE suffix pattern. This is ideal for Docker Secrets.
Supported _FILE Variables
GEMINI_API_KEY_FILETOKEN_SECRET_FILEADMIN_PASSWORD_FILEGOOGLE_CLIENT_SECRET_FILE
Usage with Docker Secrets
docker-compose.yml
Security Features
- Path validation: Prevents directory traversal attacks
- Size limits: Maximum 1MB per secret file
- Priority:
_FILEvariables override regular environment variables
Configuration Examples
Minimal Self-Hosted Setup
.env
Recommended Production Setup
.env
Production with Custom CORS
.env
Development Setup
.env
Complete Configuration Template
.env
Validation and Troubleshooting
Verify Environment Variables
Common Issues
Variables Not Loading
-
Check .env file syntax:
- No spaces around
=signs - No quotes around values (unless part of the value)
- One variable per line
- No spaces around
-
Verify file is being loaded:
Authentication Issues
- TOKEN_SECRET not set: Sessions will be invalidated on restart
- ADMIN_PASSWORD not applied: Use
RESET_ADMIN_PASSWORD=trueto force reset
CORS Errors
- Check CORS_ALLOWED_ORIGINS: Must include your frontend domain
- Verify format: Comma-separated, no spaces
- Check protocol: Must match exactly (http vs https)
Best Practices
Use Docker Secrets in production
For production Swarm deployments, use Docker Secrets instead of environment variables
Next Steps
Docker Deployment
Deploy Vega AI with Docker
Docker Compose
Use Docker Compose for easier management
Docker Swarm
Scale with Docker Swarm