Ddonisgo
Framework

Environment Variables

Referensi lengkap environment variables — App, DB, Auth, Mailer, KeyDB, Storage, CORS, logging.

App

  • APP_ENV = development | staging | production
  • APP_HOST = 0.0.0.0
  • APP_PORT = 8080
  • APP_DEBUG = true | false

Database (GORM)

  • DB_TYPE = postgres | mysql | mariadb
  • DB_HOST, DB_PORT, DB_NAME, DB_USER, DB_PASSWORD
  • DB_SSLMODE = disable | require (Postgres)
  • DB_MAX_OPEN_CONNS = 50
  • DB_MAX_IDLE_CONNS = 10
  • DB_CONN_MAX_LIFETIME_SEC = 300

Auth / Security

  • AUTH_JWT_SECRET — secret signing JWT (HS256). Wajib rahasia.
  • JWT_ACCESS_EXP_SECONDS = 900
  • JWT_REFRESH_EXP_SECONDS = 1209600

Legacy names (JWT_SECRET, JWT_ACCESS_SECRET, JWT_REFRESH_SECRET) deprecated — aplikasi prefer AUTH_JWT_SECRET lalu fallback ke legacy.

Mailer

  • SMTP_HOST, SMTP_PORT = 587, SMTP_USER, SMTP_PASS, SMTP_FROM
  • SMTP_USE_TLS, SMTP_STARTTLS

Cache / Flash (KeyDB/Redis)

  • KEYDB_HOST = 127.0.0.1, KEYDB_PORT = 6379, KEYDB_PASS, KEYDB_DB = 0

Storage

  • STORAGE_DRIVER = local | s3
  • STORAGE_ROOT = ./storage (local)
  • STORAGE_PUBLIC_URL = http://localhost:8080/assets
  • S3_BUCKET, S3_REGION, S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY (s3)

CORS

Logging & Misc

  • LOG_LEVEL = debug | info | warn | error
  • APP_URL, ADMIN_URL, FRONT_URL, DOCKER_HOST_IP

Public storage URL

  • Local: saat STORAGE_DRIVER=local, set STORAGE_PUBLIC_URL ke server base + /assets
  • S3: set ke bucket endpoint publik / CDN
  • Hindari trailing slash agar URL join tetap predictable

Security notes

  • Jangan commit .env berisi secret; jaga .env.example generic
  • Produksi: pakai secret store (Vault, AWS Secrets Manager, K8s Secrets)
  • Rotate key & pakai least-privilege untuk akun DB/service