- development (default): HTTP allowed, no TLS required
- production: HTTPS enforced for server and external services
Set via APP_MODE=development or APP_MODE=production
Default: SQLCipher with AES-256 encryption at rest
Optional: Standard SQLite (unencrypted) can be enabled for development
Warning
Production deployments should use SQLCipher to protect sensitive data at rest
To disable encryption for development purposes:
- Set
DISABLE_DB_ENCRYPTION=truein.env - Run normally:
make run,make migrate-up, ormake build
The build system automatically detects the DISABLE_DB_ENCRYPTION setting and compiles with the appropriate SQLite driver (SQLCipher or standard SQLite).
go run cmd/api/main.go # Standard SQLite
go run -tags sqlcipher cmd/api/main.go # SQLCipher
go build -o bin/api cmd/api/main.go # Standard SQLite
go build -tags sqlcipher -o bin/api cmd/api/main.go # SQLCipherNote
- When
DISABLE_DB_ENCRYPTION=false, aDB_ENCRYPTION_KEYmust be set - When
DISABLE_DB_ENCRYPTION=true, theDB_ENCRYPTION_KEYis ignored - Production mode logs a warning if encryption is disabled but doesn't enforce it
Required in production unless behind a reverse proxy:
APP_MODE=production
TLS_CERT_FILE=/path/to/cert.crt
TLS_KEY_FILE=/path/to/key.keyTip
If using reverse proxy for TLS termination (e.g., nginx, Caddy):
APP_MODE=production
ALLOW_INSECURE_SERVER=trueProduction mode requires HTTPS for Interface API:
APP_MODE=production
INTERFACE_API_URL=https://interface.example.comCaution
To allow insecure protocols in production (not recommended):
ALLOW_INSECURE_EXTERNAL=trueAPP_MODE=development
HOST=127.0.0.1
PORT=8080
DISABLE_DB_ENCRYPTION=false
INTERFACE_API_URL=http://localhost:8080APP_MODE=production
HOST=0.0.0.0
PORT=8443
TLS_CERT_FILE=/etc/ssl/certs/api.crt
TLS_KEY_FILE=/etc/ssl/private/api.key
DISABLE_DB_ENCRYPTION=false
INTERFACE_API_URL=https://interface.example.comAPP_MODE=production
HOST=127.0.0.1
PORT=8080
ALLOW_INSECURE_SERVER=true
DISABLE_DB_ENCRYPTION=false
INTERFACE_API_URL=https://interface.example.com"TLS_CERT_FILE and TLS_KEY_FILE must be set"
- Set cert/key paths or use
ALLOW_INSECURE_SERVER=truewith reverse proxy
"production mode requires HTTPS for external service"
- Update URLs to secure protocols or set
ALLOW_INSECURE_EXTERNAL=true