Skip to main content

Configuration reference

Loch S3 reads its configuration from environment variables only. Most invalid values stop the server at startup with Invalid configuration: … and exit status 1.

Server​

VariableDefaultDescription
S3_PORT8080Listen port, on all interfaces
S3_DATA_DIR./data (/data in the image)Data directory. Created if missing
S3_USERS_FILEnoneUsers JSON file. Enables multi-user mode; created with a root user if missing
S3_ACCESS_KEY_IDnoneSingle-user mode access key. Set with S3_SECRET_ACCESS_KEY. Ignored when S3_USERS_FILE is set
S3_SECRET_ACCESS_KEYnoneSingle-user mode secret key
S3_ADMIN_API_KEYnoneBearer key of the /_loch/users admin API. Only with S3_USERS_FILE. Unset: the API is off and the users file is never written
S3_ENCRYPTION_KEYnoneSSE-S3 master key: 32 bytes, base64-encoded (openssl rand -base64 32)
S3_ENCRYPTION_KEY_FILEnoneFile holding the base64 master key. Cannot be combined with S3_ENCRYPTION_KEY
S3_ENCRYPT_BY_DEFAULTfalsetrue: encrypt with SSE-S3 every write that has no SSE header. Needs a master key. Accepts true/false, 1/0, yes/no
S3_MAX_STORAGE_BYTESunlimitedQuota of the whole data directory, in bytes
S3_INIT_BUCKETSnoneComma-separated buckets created at startup if missing, owned by root
S3_UPLOAD_TTL86400Seconds before an unfinished multipart upload is deleted. Checked every 5 minutes
S3_MIN_UPLOAD_RATE4096Minimum upload speed in bytes/s over 60-second windows. 0 disables
S3_MAX_CONNECTIONS1024Maximum simultaneous connections. Extra ones are closed. An invalid value falls back to the default
S3_SHUTDOWN_GRACE8Seconds given to running requests after SIGTERM or SIGINT
S3_MAX_BLOCKING_THREADS32Size cap of the file I/O thread pool. Keep it under the container PID limit

The server refuses to start when:

  • only one of S3_ACCESS_KEY_ID and S3_SECRET_ACCESS_KEY is set, or one is empty;
  • the users file is invalid, or cannot be created;
  • the master key is empty, unreadable, not base64, or not 32 bytes once decoded, or both key variables are set;
  • S3_ENCRYPT_BY_DEFAULT=true without a master key;
  • a name in S3_INIT_BUCKETS is not a valid bucket name;
  • a numeric variable is not a number.

loch-s3 CLI​

VariableFlagDefaultDescription
LOCH_SERVER--serverhttp://localhost:8080Server URL
LOCH_ADMIN_KEY--api-keyrequiredValue of S3_ADMIN_API_KEY
LOCH_ACCESS_KEY--access-keyrequired by users putAccess key to set
LOCH_SECRET_KEY--secret-keyrequired by users putSecret key to set

Flags win over variables.