Reference
Environment o‘zgaruvchilari
Application, database, security, S3, worker, frontend, test, seed va Caddy sozlamalari.
Application va data
| Variable | Talab / default | Maqsad |
|---|---|---|
APP_ENV | Majburiy: development | test | production | Muhitni va production invariantlarini belgilaydi |
APP_URL | dev: http://localhost:8080 | Public API/application origin |
WEB_URL | dev: http://localhost:3000 | Frontend origin |
API_ADDR | :8080 | API bind address |
WORKER_ADDR | :8081 | Worker health bind |
CORS_ALLOWED_ORIGINS | Default: WEB_URL; productionda explicit | Ruxsat etilgan browser originlari |
POSTGRES_HOST | Compose | PostgreSQL host |
POSTGRES_PORT | 5432 | PostgreSQL port |
POSTGRES_DB | Required | Database nomi |
POSTGRES_USER | Required | Database user |
POSTGRES_PASSWORD | Secret | Database parol |
DATABASE_URL | Required | Go servislar DSN’i |
REDIS_URL | dev localhost | Redis DSN |
REDIS_MAXMEMORY | Compose tunable | Redis memory ceiling |
Security va S3
| Variable | Talab | Maqsad |
|---|---|---|
SESSION_SECRET | Kuchli, unique | Session security |
TRUSTED_PROXY_SECRET | Prod ≥32 belgi, unique | Caddy → API trust |
MASTER_ENCRYPTION_KEY | Base64 32 bayt | Provider credential AES-256-GCM |
AWS_REGION | dev: us-east-1 | S3 region |
AWS_S3_BUCKET | Required | Private bucket |
AWS_ACCESS_KEY_ID | Secret/IAM | S3 credential |
AWS_SECRET_ACCESS_KEY | Secret/IAM | S3 credential |
AWS_SESSION_TOKEN | Optional | Temporary credential |
AWS_S3_ENDPOINT | Optional; prod HTTPS | S3-compatible endpoint |
AWS_S3_FORCE_PATH_STYLE | Default: false | Path-style addressing |
Worker
| Variable | Default | Maqsad |
|---|---|---|
JOB_CONCURRENCY | 4 (1–128) | Parallel joblar |
JOB_POLL_INTERVAL | 1s | Queue polling |
JOB_LEASE_DURATION | 30s | Ownership lease |
JOB_HEARTBEAT_INTERVAL | 10s | Lease heartbeat |
JOB_TIMEOUT | 2m | Bitta job deadline |
JOB_SHUTDOWN_GRACE | 15s | Graceful stop |
JOB_BACKOFF_BASE | 2s | Retry boshlanishi |
JOB_BACKOFF_MAX | 5m | Retry maksimumi |
Seed, image va edge
| Variable | Talab | Maqsad |
|---|---|---|
INITIAL_ADMIN_EMAIL | Seed uchun | Birinchi admin email |
INITIAL_ADMIN_PASSWORD | Seed secret | Vaqtinchalik parol |
SEED_IMAGE | Optional | Seed command image override |
CADDY_DOMAIN | Production FQDN | TLS virtual host |
CADDY_EMAIL | ACME email | Certificate notifications |
CADDY_HTTP_PORT | 80 | Host HTTP port |
CADDY_HTTPS_PORT | 443 | Host HTTPS port |
Frontend va test runtime
| Variable | Talab / default | Maqsad |
|---|---|---|
API_INTERNAL_URL | http://localhost:8080 | Next.js server rewrite va root auth probe uchun ichki API origin |
E2E_BASE_URL | http://127.0.0.1:3200 | Playwright tekshiradigan frontend URL; berilsa lokal web server ko‘tarilmaydi |
E2E_IGNORE_HTTPS_ERRORS | Default: false | Self-signed TLS ishlatilgan E2E muhitida HTTPS xatolarini e’tiborsiz qoldirish |
E2E_ADMIN_EMAIL | Admin E2E uchun | Authenticated sidebar va admin oqimlarida login email |
E2E_ADMIN_PASSWORD | Admin E2E uchun | Authenticated E2E login paroli |
TEST_DATABASE_URL | Fallback: DATABASE_URL | Go integration testlari uchun alohida PostgreSQL DSN |
TEST_REDIS_URL | Fallback: REDIS_URL | Redisga bog‘liq integration testlar uchun DSN |
CI | CI runner belgilaydi | Playwright retry soni va web server reuse siyosatini o‘zgartiradi |
Test izolyatsiyasi
TEST_DATABASE_URL va TEST_REDIS_URL qiymatlarini development yoki production data servislariga qaratmang. Integration testlari yozuv va cleanup amallarini bajaradi.
Minimal production skeleti
.env (secret qiymatlar placeholder)
APP_ENV=production
APP_URL=https://ai.example.uz
WEB_URL=https://ai.example.uz
CORS_ALLOWED_ORIGINS=https://ai.example.uz
DATABASE_URL=postgres://…
REDIS_URL=redis://redis:6379/0
SESSION_SECRET=<secret-manager-value>
TRUSTED_PROXY_SECRET=<different-32+-char-secret>
MASTER_ENCRYPTION_KEY=<canonical-base64-32-byte-key>
AWS_REGION=us-east-1
AWS_S3_BUCKET=edubase-ai-prod
CADDY_DOMAIN=ai.example.uz
CADDY_EMAIL=ops@example.uz