Configuration

S4 is configured through environment variables. All settings have sensible defaults for development.

Environment Variables

Variable Description Default
S4_BIND Bind host address 127.0.0.1
S4_DATA_DIR Base directory for storage data System temp dir
S4_ACCESS_KEY_ID Access key for S3 authentication Auto-generated dev key
S4_SECRET_ACCESS_KEY Secret key for S3 authentication Auto-generated dev key
S4_ROOT_USERNAME Root admin username root
S4_ROOT_PASSWORD Root admin password (enables IAM) None (IAM disabled)
S4_JWT_SECRET Secret key for signing JWT tokens Auto-generated at startup
S4_MAX_UPLOAD_SIZE Maximum upload size per request 5GB
S4_TLS_CERT Path to TLS certificate (PEM) None (HTTP mode)
S4_TLS_KEY Path to TLS private key (PEM) None (HTTP mode)
S4_LIFECYCLE_ENABLED Enable lifecycle policy worker true
S4_LIFECYCLE_INTERVAL_HOURS Lifecycle evaluation interval 24
S4_LIFECYCLE_DRY_RUN Dry-run mode (log without deleting) false
S4_METRICS_ENABLED Enable Prometheus metrics true

Size Format

The S4_MAX_UPLOAD_SIZE variable supports human-readable size suffixes:

  • GB or G — gigabytes
  • MB or M — megabytes
  • KB or K — kilobytes
  • No suffix — bytes

Examples: 5GB, 100MB, 1024KB, 5368709120

Example: Development Setup

export S4_ACCESS_KEY_ID=myaccesskey
export S4_SECRET_ACCESS_KEY=mysecretkey
export S4_DATA_DIR=/tmp/s4-data

./target/release/s4-server

Example: Production Setup

export S4_BIND=0.0.0.0
export S4_DATA_DIR=/var/lib/s4
export S4_ROOT_PASSWORD=your-strong-password
export S4_JWT_SECRET=your-256-bit-crypto-random-string
export S4_TLS_CERT=/etc/ssl/certs/s4.pem
export S4_TLS_KEY=/etc/ssl/private/s4-key.pem
export S4_MAX_UPLOAD_SIZE=10GB

./target/release/s4-server

Optional Configuration File

You can also use a config.toml file:

[server]
bind = "0.0.0.0:9000"

[storage]
data_path = "/var/lib/s4/volumes"
metadata_path = "/var/lib/s4/metadata.redb"

[tuning]
inline_threshold = 4096  # 4KB — objects below this are stored inline in the database
volume_size_mb = 1024    # 1GB — maximum size of each append-only volume file
strict_sync = true       # fsync after every write