FeedForward uses environment variables for configuration, allowing flexible deployment across different environments. This guide details all available configuration options, their purposes, and recommended settings.
FeedForward looks for configuration in the following order:
.env file in the project root# Copy example configuration
cp .env.example .env
# Edit with your settings
nano .env
# Comments start with #
KEY=value
# Multi-line values use quotes
LONG_VALUE="Line 1
Line 2
Line 3"
# Booleans: true/false, yes/no, 1/0
DEBUG=false
# Lists use comma separation
ALLOWED_HOSTS=localhost,feedforward.edu,www.feedforward.edu
SECRET_KEY=your-very-long-random-secret-key-herepython
python -c "import secrets; print(secrets.token_urlsafe(32))"Never use the default secret key in production. Always generate a new one.
falseDEBUG=falsetrue, falseNever enable DEBUG in production. It exposes sensitive information.
localhost,127.0.0.1ALLOWED_HOSTS=feedforward.edu,www.feedforward.eduFeedForwardAPP_NAME=University Writing CenterAPP_DOMAIN=https://feedforward.university.eduAI-assisted feedback platformAPP_DESCRIPTION=Writing feedback system for students86400 (24 hours)SESSION_LIFETIME=43200 (12 hours)trueSESSION_COOKIE_SECURE=truetrueSESSION_COOKIE_HTTPONLY=truedata/feedforward.dbDATABASE_PATH=/var/lib/feedforward/data.dbdata/backupsDATABASE_BACKUP_PATH=/backup/feedforwardWALDATABASE_JOURNAL_MODE=WALDELETE, TRUNCATE, PERSIST, MEMORY, WAL, OFF# PostgreSQL configuration (when supported)
DATABASE_TYPE=postgresql
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_NAME=feedforward
DATABASE_USER=feedforward_user
DATABASE_PASSWORD=secure_password
DATABASE_SSL_MODE=require
SMTP_SERVER=smtp.university.edu587SMTP_PORT=58725, 465, 587, 2525SMTP_USER=feedforward@university.eduSMTP_PASSWORD=secure_smtp_passwordSMTP_FROM=noreply@university.edutrueSMTP_USE_TLS=truefalseSMTP_USE_SSL=false[FeedForward]EMAIL_SUBJECT_PREFIX=[Writing Center]EMAIL_FOOTER_TEXT=University Writing Center - Do not replyFeedForward supports multiple AI providers. Configure at least one:
OPENAI_API_KEY=sk-...OPENAI_ORG_ID=org-...https://api.openai.com/v1OPENAI_API_BASE=https://api.openai.com/v1ANTHROPIC_API_KEY=sk-ant-...https://api.anthropic.comANTHROPIC_API_BASE=https://api.anthropic.comGOOGLE_API_KEY=...GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.jsonhttp://localhost:11434OLLAMA_BASE_URL=http://localhost:11434ollamaOLLAMA_API_KEY=custom_keyDEFAULT_AI_MODEL=gpt-4300AI_TIMEOUT=6003AI_MAX_RETRIES=50.7AI_TEMPERATURE_DEFAULT=0.524DRAFT_RETENTION_HOURS=480 (indefinite)FEEDBACK_RETENTION_DAYS=36530LOG_RETENTION_DAYS=90trueENABLE_ANALYTICS=falsefalseANONYMIZE_SUBMISSIONS=truetrueALLOW_DATA_EXPORT=true10MAX_UPLOAD_SIZE_MB=2510485760 (10MB)MAX_CONTENT_LENGTH=26214400txt,pdf,docxALLOWED_EXTENSIONS=txt,pdf,docx,doc,rtftrueSCAN_UPLOADS=trueWORKER_PROCESSES=41WORKER_THREADS=2300WORKER_TIMEOUT=600trueENABLE_CACHE=true3600CACHE_TTL=7200INFOLOG_LEVEL=WARNINGDEBUG, INFO, WARNING, ERROR, CRITICALWARNINGSQL_LOG_LEVEL=DEBUGlogs/feedforward.logLOG_FILE=/var/log/feedforward/app.log%(asctime)s - %(name)s - %(levelname)s - %(message)sLOG_FORMAT=%(asctime)s [%(levelname)s] %(message)strueLOG_TO_CONSOLE=falsetrueENABLE_REGISTRATION=falsefalseENABLE_OAUTH=truefalseENABLE_API=truefalseENABLE_WEBHOOKS=trueLMS_TYPE=canvascanvas, moodle, blackboardLMS_API_URL=https://canvas.university.edu/api/v1LMS_API_KEY=...SENTRY_DSN=https://...@sentry.io/...ANALYTICS_ID=UA-123456789-1# Development settings
DEBUG=true
SECRET_KEY=dev-secret-key-not-for-production
ALLOWED_HOSTS=localhost,127.0.0.1
DATABASE_PATH=data/dev.db
LOG_LEVEL=DEBUG
EMAIL_BACKEND=console # Print emails to console
AI_TIMEOUT=60 # Faster timeout for testing
# Staging settings
DEBUG=false
SECRET_KEY=${STAGING_SECRET_KEY}
ALLOWED_HOSTS=staging.feedforward.edu
DATABASE_PATH=/var/lib/feedforward/staging.db
LOG_LEVEL=INFO
EMAIL_BACKEND=smtp
ENABLE_ANALYTICS=false
# Production settings
DEBUG=false
SECRET_KEY=${PRODUCTION_SECRET_KEY}
ALLOWED_HOSTS=feedforward.university.edu,www.feedforward.university.edu
DATABASE_PATH=/var/lib/feedforward/production.db
LOG_LEVEL=WARNING
EMAIL_BACKEND=smtp
ENABLE_ANALYTICS=true
SESSION_COOKIE_SECURE=true
SESSION_COOKIE_HTTPONLY=true
FeedForward includes a configuration validation tool:
# Validate configuration
python tools/validate_config.py
# Test specific settings
python tools/validate_config.py --test-email
python tools/validate_config.py --test-ai
python tools/validate_config.py --test-database
Missing Required Values
ERROR: SECRET_KEY is required but not set
Solution: Set all required environment variables
Invalid Values
ERROR: LOG_LEVEL must be one of: DEBUG, INFO, WARNING, ERROR, CRITICAL
Solution: Use valid values from documentation
Connection Failures
ERROR: Cannot connect to SMTP server smtp.example.com:587
Solution: Verify server settings and credentials
Never commit secrets
bash
# Add to .gitignore
.env
.env.*
*.key
*.pem
Use environment variables
bash
# Production deployment
export SECRET_KEY=$(cat /run/secrets/feedforward_secret_key)
export OPENAI_API_KEY=$(cat /run/secrets/openai_api_key)
Rotate regularly - Change SECRET_KEY quarterly - Rotate API keys monthly - Update passwords regularly
FeedForward uses secure defaults: - HTTPS required in production - Session cookies secure by default - Debug mode disabled by default - Strong password requirements
Check loaded values
python
python -c "from app.config import settings; print(settings)"
Verify environment
bash
env | grep -E '^(APP_|DATABASE_|SMTP_)'
Test components ```bash # Test database python tools/test_database.py
# Test email python tools/test_email.py recipient@example.com
# Test AI providers python tools/test_ai_providers.py ```
Issue: Changes not taking effect - Solution: Restart application after changes - Check: Environment variable precedence
Issue: Can't connect to services - Solution: Verify firewall rules - Check: Service URLs and ports
Issue: Performance problems - Solution: Adjust worker settings - Check: Resource limits
# Minimum required for production
SECRET_KEY=your-secure-random-key
APP_DOMAIN=https://feedforward.example.edu
OPENAI_API_KEY=sk-...
SMTP_SERVER=smtp.example.edu
SMTP_USER=feedforward@example.edu
SMTP_PASSWORD=smtp-password
# Complete production configuration
# Security
SECRET_KEY=very-long-secure-random-key
DEBUG=false
ALLOWED_HOSTS=feedforward.edu,www.feedforward.edu
# Application
APP_NAME=University Writing Feedback
APP_DOMAIN=https://feedforward.university.edu
APP_DESCRIPTION=AI-powered writing feedback for students
SESSION_LIFETIME=43200
SESSION_COOKIE_SECURE=true
SESSION_COOKIE_HTTPONLY=true
# Database
DATABASE_PATH=/var/lib/feedforward/data/production.db
DATABASE_BACKUP_PATH=/backup/feedforward
DATABASE_JOURNAL_MODE=WAL
# Email
SMTP_SERVER=smtp.university.edu
SMTP_PORT=587
SMTP_USER=feedforward@university.edu
SMTP_PASSWORD=secure-smtp-password
SMTP_FROM=noreply@university.edu
SMTP_USE_TLS=true
# AI Providers
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
DEFAULT_AI_MODEL=gpt-4
AI_TIMEOUT=600
AI_MAX_RETRIES=5
# Privacy
DRAFT_RETENTION_HOURS=48
ANONYMIZE_SUBMISSIONS=true
ENABLE_ANALYTICS=true
# Performance
WORKER_PROCESSES=8
WORKER_THREADS=2
ENABLE_CACHE=true
# Logging
LOG_LEVEL=INFO
LOG_FILE=/var/log/feedforward/app.log
# Features
ENABLE_REGISTRATION=true
ENABLE_API=true
# Monitoring
SENTRY_DSN=https://...@sentry.io/...
Keep a secure backup of your production configuration. Document any custom settings for your deployment.
Always validate configuration changes in a staging environment before applying to production.