# MAYA OS ENTERPRISE — CONFIGURATION REFERENCE

All secrets and environment overrides live in `.env` (permissions `0600`, never committed to Git or bundled in release ZIPs). Use `.env.example` as the authoritative template.

## Core Environment Variables

| Variable | Description | Example / Default |
| :--- | :--- | :--- |
| `DB_ENGINE` | Mandatory database engine identifier | `mysql` (only supported value) |
| `MYSQL_HOST` | MySQL host | `mysql` (Docker) / `127.0.0.1` |
| `MYSQL_PORT` | MySQL TCP port | `3306` |
| `MYSQL_DATABASE` | Authoritative database name | `maya_os` |
| `MYSQL_USER` | Runtime MySQL username | `maya_app` |
| `MYSQL_PASSWORD` | Runtime MySQL password | Strong generated secret |
| `MYSQL_MIGRATION_USER` | Optional migration user for `./update.sh` / `./restore.sh` | `maya_mig` |
| `MYSQL_REPLICA_HOST` | Optional read replica host for reporting queries | Unset |
| `DJANGO_SECRET_KEY` | Django cryptographic signing key (64+ chars) | Generated by `./install.sh` |
| `DJANGO_DEBUG` | Must be `false` in production | `false` |
| `DJANGO_ALLOWED_HOSTS` | Comma-separated canonical hostnames | `erp.company.com.np` |
| `CSRF_TRUSTED_ORIGINS` | Explicit HTTPS origins | `https://erp.company.com.np` |
| `MAYA_FIELD_ENCRYPTION_KEY` | 32-byte URL-safe Fernet key encrypting sensitive bank/API secrets | Generated by `./install.sh` |
| `BOOTSTRAP_SETUP_TOKEN` | One-time secret token gating initial Super Admin bootstrap API | Generated by `./install.sh` |
| `BACKUP_ENCRYPTION_PASSPHRASE` | Optional passphrase enabling OpenSSL AES-256-CBC on `.sql.gz` backups | Unset or vault secret |
| `BACKUP_RETENTION_COUNT` | Number of backup artifacts retained by `backup.sh` | `14` |
| `REDIS_URL` | Redis URL for cache and Django Channels | `redis://127.0.0.1:6379/0` |
| `CELERY_BROKER_URL` | Celery Redis broker URL | `redis://127.0.0.1:6379/0` |
| `PRIVATE_DOCUMENT_ROOT` | Private storage path outside public webroot | `/srv/maya-os/private_documents` |
| `BACKUP_ROOT` | Local encrypted backup archive directory | `/srv/maya-os/backups` |
| `APP_TIME_ZONE` | System default timezone | `Asia/Kathmandu` |

