TMA CloudTMA Cloud
Reference

Environment Variables

Complete reference for all environment variables in TMA Cloud.

Complete reference for all environment variables in TMA Cloud.

Application Configuration

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

Reverse proxy trust is configured in SettingsAdministrationKnown Proxies, not through an environment variable. See Known Proxies.

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
FORCE_INSECURE_COOKIESNofalseIf true, auth cookie has no Secure flag in production
SESSION_IDLE_DAYSNo30Days of inactivity before a session ends

SESSION_IDLE_DAYS: Tokens are issued for this window and re-issued while the user is active, so an active user is not logged out mid-use. A session ends after this many days with no requests. Values below 1 are ignored and fall back to 30. See Authentication.

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
FILE_ENCRYPTION_KEYYes (production)Development defaultKey-encryption key (KEK) for files
FILE_KEK_VERSIONNo1Version of the current KEK

Note: File contents use bounded streaming. The multipart uploader buffers at most four parts per active upload. Per-file size is controlled by the max upload size setting in SettingsStorage.

Key rotation: To rotate, set a new FILE_ENCRYPTION_KEY, increment FILE_KEK_VERSION, and keep the previous key as FILE_ENCRYPTION_KEY_V<oldVersion> (e.g. FILE_ENCRYPTION_KEY_V1) until rotate-kek.js reports Remaining=0. See CLI Commands.

S3-compatible

A bucket is required. The backend stops at startup if its endpoint, bucket name, access key, or secret key is missing.

Supported: Cloudflare R2 (R2*), RustFS / other S3 (RUSTFS*), AWS S3 (AWS_). Use one set of vars.

Cloudflare R2

SettingRequiredDefaultEnv var
Account IDYes*-R2_ACCOUNT_ID
BucketYes*-R2_BUCKET
Access keyYes*-R2_ACCESS_KEY_ID
Secret keyYes*-R2_SECRET_ACCESS_KEY
EndpointNoderivedR2_ENDPOINT (optional)
Public URLNo-R2_PUBLIC_URL (optional)

R2_ACCESS_KEY and R2_SECRET_KEY are accepted as fallbacks for the two key variables, but R2_ACCESS_KEY_ID and R2_SECRET_ACCESS_KEY take precedence when both are set.

*Required when using R2. Endpoint is https://<R2_ACCOUNT_ID>.r2.cloudflarestorage.com unless R2_ENDPOINT is set. Region is set to auto for R2.

Other S3-compatible (RustFS, AWS, etc.)

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 not using R2. Use one set of names consistently.

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. Review orphans periodically from SettingsAdministration; see Orphan Review.

OnlyOffice Background Save

VariableRequiredDefaultDescription
ONLYOFFICE_AUTOSAVE_INTERVAL_MSNo300000Interval for worker force-save schedules
ONLYOFFICE_REJECT_UNAUTHORIZEDNotrueSet to false for a self-signed OnlyOffice cert

ONLYOFFICE_AUTOSAVE_INTERVAL_MS is optional. Do not set it when the five-minute default is suitable. Valid overrides are 1-60 whole minutes that divide evenly into an hour; invalid values use five minutes. The standalone worker must be running for scheduled force-save commands.

Keep ONLYOFFICE_REJECT_UNAUTHORIZED enabled unless the document server uses a self-signed certificate on a trusted network.

Desktop Development

VariableRequiredDefaultDescription
TMA_CLOUDFS_EXENoBuild output pathCloud Drive host executable override
TMA_CLOUD_CLIPBOARD_DEBUGNo0Set to 1 to log desktop clipboard diagnostics

These variables affect the Electron client and are not server settings. Clipboard diagnostics can contain local file paths; disable them outside development.

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.1,::ffff:127.0.0.1,::1Comma-separated IPs allowed to access /metrics
QUEUE_METRICS_INTERVAL_SECONDSNo60Audit queue gauge refresh interval (minimum 10)

Audit Logging Configuration

VariableRequiredDefaultDescription
AUDIT_WORKER_CONCURRENCYNo5Audit batch size and worker concurrency cap
AUDIT_JOB_TTL_SECONDSNo82800 (23h)Job TTL (must be < 24h)

Last Access Time

VariableRequiredDefaultDescription
ACCESS_TIME_TRACKINGNo1Set to 0 or false to stop recording access times
ACCESS_TIME_WINDOW_MINUTESNo60How stale a stored value must be before it is rewritten
ACCESS_TIME_FLUSH_SECONDSNo10How long updates are buffered before being written

ACCESS_TIME_WINDOW_MINUTES: Repeat reads of the same item inside this window are not written down at all. The default of 60 matches the one-hour accuracy NTFS guarantees for its last-access time. Lower it for finer timestamps at the cost of more writes, or set it to 0 to record every read.

ACCESS_TIME_FLUSH_SECONDS: Updates are held in memory and written in one batched statement per interval, so a download never waits on the write. Raising it reduces the number of statements; lowering it makes timestamps appear sooner. Buffered updates are flushed on shutdown.

ACCESS_TIME_TRACKING: Turning it off leaves existing accessed_at values in place but stops updating them. Windows offers the same switch as NtfsDisableLastAccessUpdate. See File System.

On this page