# ==============================================
# Maternal App - Backend Configuration Template
# ==============================================
# Copy this file to .env and fill in your values
# Never commit .env files with real credentials!

# -----------------
# Environment
# -----------------
NODE_ENV=development
API_PORT=3020
API_URL=http://localhost:3020

# -----------------
# Database
# -----------------
DATABASE_HOST=localhost
DATABASE_PORT=5432
DATABASE_NAME=maternal_app
DATABASE_USER=maternal_user
DATABASE_PASSWORD=your-secure-password-here

# Database SSL (required for production)
DATABASE_SSL=false
DATABASE_SSL_REJECT_UNAUTHORIZED=true

# -----------------
# Redis Cache
# -----------------
REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_URL=redis://localhost:6379
REDIS_TTL=3600

# -----------------
# MongoDB (AI Chat History)
# -----------------
MONGODB_URI=mongodb://localhost:27017/maternal_ai_chat

# -----------------
# MinIO (S3-Compatible Storage)
# -----------------
MINIO_ENDPOINT=localhost
MINIO_PORT=9000
MINIO_USE_SSL=false
MINIO_ACCESS_KEY=your-minio-access-key
MINIO_SECRET_KEY=your-minio-secret-key
MINIO_BUCKET=maternal-files
MINIO_REGION=us-east-1

# -----------------
# JWT Authentication
# -----------------
JWT_SECRET=change-this-to-a-secure-random-string-in-production
JWT_EXPIRATION=1h
JWT_REFRESH_SECRET=change-this-to-another-secure-random-string
JWT_REFRESH_EXPIRATION=7d

# -----------------
# AI Services
# -----------------
# Primary provider: 'openai' or 'azure'
AI_PROVIDER=azure

# OpenAI Configuration
OPENAI_API_KEY=
OPENAI_MODEL=gpt-4o-mini
OPENAI_EMBEDDING_MODEL=text-embedding-3-small
OPENAI_MAX_TOKENS=1000

# Azure OpenAI - Chat/Completion
AZURE_OPENAI_ENABLED=true
AZURE_OPENAI_CHAT_ENDPOINT=
AZURE_OPENAI_CHAT_DEPLOYMENT=
AZURE_OPENAI_CHAT_API_VERSION=2025-04-01-preview
AZURE_OPENAI_CHAT_API_KEY=
AZURE_OPENAI_CHAT_MAX_TOKENS=1000
AZURE_OPENAI_REASONING_EFFORT=medium

# Azure OpenAI - Whisper/Voice
AZURE_OPENAI_WHISPER_ENDPOINT=
AZURE_OPENAI_WHISPER_DEPLOYMENT=whisper
AZURE_OPENAI_WHISPER_API_VERSION=2024-06-01
AZURE_OPENAI_WHISPER_API_KEY=

# Azure OpenAI - Embeddings
AZURE_OPENAI_EMBEDDINGS_ENDPOINT=
AZURE_OPENAI_EMBEDDINGS_DEPLOYMENT=text-embedding-ada-002
AZURE_OPENAI_EMBEDDINGS_API_VERSION=2023-05-15
AZURE_OPENAI_EMBEDDINGS_API_KEY=

# -----------------
# Security
# -----------------
# CORS Origins (comma-separated)
CORS_ORIGIN=http://localhost:3030,http://localhost:19000

# Rate Limiting
RATE_LIMIT_TTL=60
RATE_LIMIT_MAX=100

# -----------------
# Logging
# -----------------
LOG_LEVEL=info
LOG_DIR=logs

# -----------------
# Error Tracking (Sentry)
# -----------------
SENTRY_ENABLED=false
SENTRY_DSN=
SENTRY_SAMPLE_RATE=1.0
SENTRY_TRACES_SAMPLE_RATE=0.1
SENTRY_PROFILES_SAMPLE_RATE=0.1
APP_VERSION=1.0.0

# -----------------
# Analytics
# -----------------
ANALYTICS_ENABLED=false
ANALYTICS_PROVIDER=posthog
POSTHOG_API_KEY=
POSTHOG_HOST=https://app.posthog.com

# -----------------
# Email Service (Mailgun)
# -----------------
MAILGUN_API_KEY=
MAILGUN_DOMAIN=
MAILGUN_REGION=eu
EMAIL_FROM=noreply@maternal-app.com
EMAIL_FROM_NAME=Maternal App
APP_URL=http://localhost:3030

# -----------------
# Backups
# -----------------
BACKUP_ENABLED=false
BACKUP_SCHEDULE=0 2 * * *
BACKUP_RETENTION_DAYS=30
BACKUP_S3_BUCKET=
BACKUP_S3_REGION=
BACKUP_S3_ACCESS_KEY=
BACKUP_S3_SECRET_KEY=
