Overview
Support Bot uses environment variables for configuration. All settings are defined in a.env file that should be created from the provided .env.example template.
Setup
Required Variables
AI Model Configuration
The AI model to use for chat completions.Examples:
gemini-2.0-flash-exp(Google Gemini)gpt-4(OpenAI)claude-3-opus(Anthropic)llama3(Ollama)
Google AI (Gemini)
Multiple API keys for load balancing (comma-separated).Use this when you have multiple Gemini API keys to distribute requests and avoid rate limits.
Alternative Google API key for backward compatibility.
Only one of
GEMINI_API_KEY, GEMINI_API_KEYS, or GOOGLE_API_KEY is required if using Gemini models.Database Configuration
Async PostgreSQL connection string for the main database.Format: Production example:
postgresql+asyncpg://user:password@host:port/databaseDefault (development):Synchronous PostgreSQL connection string for migrations and scripts.Format: Used by Alembic for database migrations.
postgresql://user:password@host:port/databaseDefault (development):PostgreSQL connection string for the pgvector database.Format: Stores vector embeddings for semantic search.
postgresql://user:password@host:port/databaseDefault (development):URL for the Qdrant vector search engine.Default (development):Production example:
Authentication & Security
Secret key for signing JWT tokens.Generate a secure key:Example:
Algorithm for JWT token signing.Recommended: Other options:
HS256HS384, HS512, RS256JWT token expiration time in seconds.Default: Examples:
86400 (24 hours)- 1 hour:
3600 - 7 days:
604800 - 30 days:
2592000
Key for encrypting sensitive data at rest.Generate using Fernet:Example:
Enable/disable password strength validation.
true: Enforce password complexity requirementsfalse: Allow any password (development only)
Environment-Specific Configuration
Development (.env)
For local development with Docker Compose:Production (.env.prod)
For production deployment:Loading Environment Variables
Python Application
The application automatically loads.env using python-dotenv:
Docker Compose
Specify the env file indocker-compose.yml:
Manual Loading
Validation
Verify your configuration before deployment:- Check Required Variables
- Test Database Connection
- Validate API Keys
Security Best Practices
Use environment-specific files
Use environment-specific files
Maintain separate files for each environment:
.env- Development.env.prod- Production.env.test- Testing
.gitignore:Rotate secrets regularly
Rotate secrets regularly
Update credentials periodically:
Use secrets management in production
Use secrets management in production
Consider using:
- AWS Secrets Manager
- HashiCorp Vault
- Azure Key Vault
- Google Secret Manager
Restrict file permissions
Restrict file permissions
Troubleshooting
Environment Not Loading
Variables not found
Variables not found
- Verify file location:
- Check file format (no BOM, Unix line endings):
- Validate syntax:
Docker not loading .env
Docker not loading .env
Verify Check loaded variables:
env_file in docker-compose.yml:Connection Errors
Database connection failed
Database connection failed
- Verify URL format:
- Check host reachability:
- Test credentials:
Invalid API key
Invalid API key
- Check key is set:
- Verify no extra whitespace:
- Test in API console:
Next Steps
Installation
Complete installation steps
Docker Deployment
Deploy with Docker Compose