Skip to main content

Environment Variables

Complete reference for all environment variables in TMA Cloud.

Application Configuration

VariableRequiredDefaultDescription
NODE_ENVNodevelopmentEnvironment mode
BPORTNo3000Backend server port
BACKEND_URLYes (OnlyOffice)-Public backend URL

Database Configuration

VariableRequiredDefaultDescription
DB_HOSTNolocalhostPostgreSQL host
DB_PORTNo5432PostgreSQL port
DB_USERNopostgresDatabase username
DB_PASSWORDYes-Database password
DB_NAMENotma_cloud_storageDatabase name
DB_SSLMODENodisableSSL mode (require for TLS)
PGBOSS_SCHEMANopgbosspg-boss job queue schema
DB_CONTAINERNoauto-detectedDocker container name for backup/restore script
BACKUP_RETAIN_COUNTNo10Number of database backups to keep before pruning

Redis Configuration

VariableRequiredDefaultDescription
REDIS_HOSTNolocalhostRedis host
REDIS_PORTNo6379Redis port
REDIS_PASSWORDNo-Redis password (recommended)
REDIS_DBNo0Redis database number

Note: Redis is optional. App works without it but caching is disabled.

Authentication

VariableRequiredDefaultDescription
JWT_SECRETYes-Secret key for JWT tokens
SESSION_BINDINGNotrueEnable session binding (browser fingerprint)
FORCE_INSECURE_COOKIESNofalseIf true, auth cookie has no Secure flag in production

Google OAuth (Optional)

VariableRequiredDescription
GOOGLE_CLIENT_IDNoGoogle OAuth Client ID
GOOGLE_CLIENT_SECRETNoGoogle OAuth Client Secret
GOOGLE_REDIRECT_URINoRedirect URI (must match Google Console)

Note: All three must be set to enable Google OAuth.

File Storage

VariableRequiredDefaultDescription
STORAGE_DRIVERNolocallocal or s3
UPLOAD_DIRNo./uploadsUpload directory (local only)
FILE_ENCRYPTION_KEYNoDevelopment defaultEncryption key for file encryption

Note: All file operations use streaming for large files. No memory limits for file size.

S3-compatible (when STORAGE_DRIVER=s3)

SettingRequiredDefaultEnv var (either name)
EndpointYes*-RUSTFS_ENDPOINT or AWS_S3_ENDPOINT
BucketYes*-RUSTFS_BUCKET or AWS_S3_BUCKET
Access keyYes*-RUSTFS_ACCESS_KEY or AWS_ACCESS_KEY_ID
Secret keyYes*-RUSTFS_SECRET_KEY or AWS_SECRET_ACCESS_KEY
RegionNous-east-1RUSTFS_REGION or AWS_REGION
Path styleNotrueRUSTFS_FORCE_PATH_STYLE (set false to disable)

*Required when STORAGE_DRIVER=s3. Use one set of names consistently (e.g. all AWS** or all RUSTFS**).

Note: From backend, npm run s3:protect-all applies bucket protections (public access block, HTTPS-only policy, versioning, optional encryption, lifecycle). Lifecycle aborts incomplete multipart after 1 day and deletes noncurrent versions after 7 days. Run orphan cleanup frequently; see Storage Management.

Logging Configuration

VariableRequiredDefaultDescription
LOG_LEVELNoinfoLog level (fatal, error, warn, info, debug, trace)
LOG_FORMATNojson (prod), pretty (dev)Log format (json, pretty)
METRICS_ALLOWED_IPSNo127.0.0.1Comma-separated IPs allowed to access /metrics

Audit Logging Configuration

VariableRequiredDefaultDescription
AUDIT_WORKER_CONCURRENCYNo5Concurrent audit events processed
AUDIT_JOB_TTL_SECONDSNo82800 (23h)Job TTL (must be < 24h)