Skip to content

Configuration

SwiftFS Core reads its configuration from SWIFTFS_* environment variables. Sizes accept units (5GiB, 32MiB); durations accept Go's form (30s, 168h).

Required

VariableNotes
SWIFTFS_DATABASE_URLPostgreSQL connection URL
SWIFTFS_ENCRYPTION_KEY32 random bytes, base64 (openssl rand -base64 32). Encrypts access-key secrets. Back it up.

Storage

VariableDefaultNotes
SWIFTFS_STORAGE_PATH./data (/data in the image)Where object data is written
SWIFTFS_FSYNCtrueSync every object to disk before acknowledging it. Only disable for throwaway environments.
SWIFTFS_MAX_OBJECT_SIZE5 GiBLargest single PutObject or CopyObject; larger objects use multipart
SWIFTFS_MULTIPART_EXPIRY168hUnfinished multipart uploads are aborted after this

S3 API

VariableDefaultNotes
SWIFTFS_S3_ADDR:9000Listen address
SWIFTFS_PUBLIC_ENDPOINThttp://localhost:9000The S3 API's URL as clients reach it (scheme and host)
SWIFTFS_REGIONus-east-1The region clients sign for
SWIFTFS_S3_DOMAINEnables virtual-hosted addresses (bucket.<domain>); needs wildcard DNS and TLS
SWIFTFS_CORS_ORIGINSBrowser origins allowed on every bucket after the bucket's own rules, for a web console (comma-separated)
SWIFTFS_ROOT_ACCESS_KEY, SWIFTFS_ROOT_SECRET_KEYOptional bootstrap credentials for the default account. Prefer per-account keys.
SWIFTFS_BODY_IDLE_TIMEOUT60sUploads and downloads that make no progress for this long are cut

Protection

VariableDefaultNotes
SWIFTFS_RATE_LIMIT_RPS, _BURST0 (off)Requests per second per access key
SWIFTFS_ANON_RATE_LIMIT_RPS, _BURST50, 100Per client IP, for anonymous requests and CORS preflights
SWIFTFS_TRUSTED_PROXIESCIDRs allowed to set X-Forwarded-For
SWIFTFS_QUOTA_REFRESH30sHow long account limits and usage are cached

Operations

VariableDefaultNotes
SWIFTFS_OPS_ADDR:9100Health checks and metrics. Keep it private (for example 127.0.0.1:9100).
SWIFTFS_AUTO_MIGRATEtrueApply database migrations at start-up
SWIFTFS_SHUTDOWN_TIMEOUT30sHow long in-flight requests get on shutdown
SWIFTFS_LOG_LEVEL, SWIFTFS_LOG_FORMATinfo, jsontext for human-readable logs

Background work

VariableDefaultNotes
SWIFTFS_SCRUB_RATE32MiBHow fast stored data is re-read and verified, per second; 0 disables
SWIFTFS_SCRUB_INTERVAL1mScrubber slice length
SWIFTFS_RECONCILE_INTERVAL, SWIFTFS_ORPHAN_GRACE6h, 1hCleanup of orphaned data, stale temporary files and empty directories
SWIFTFS_GC_INTERVAL, SWIFTFS_GC_GRACE1m, 5mRemoval of data no longer referenced, after a grace period
SWIFTFS_USAGE_FLUSH_INTERVAL10sHow often request counters are written
SWIFTFS_USAGE_ROLLUP_INTERVAL5mHow often hourly storage figures are computed