Skip to content

Environment Variables ​

The following environment variables can be configured in your .env file.

Most numeric variables stop startup with an error naming the variable when set to an invalid value (such as API_PORT=80800), while an unset or empty variable uses its default. Two groups differ:

  • API_LOGIN_MAX_FAILURES, API_LOGIN_IP_MAX_FAILURES, and API_LOGIN_WINDOW_SECS log a warning and fall back to their defaults on invalid values.
  • LOG_MAX_FILE_BYTES, LOG_MAX_FILES, RUST_SREC_SHUTDOWN_TIMEOUT_SECS, and RUST_SREC_SHUTDOWN_FORCE_RESERVE_SECS fail startup on both invalid values and empty assignments (VAR=); unset them to use defaults.

General ​

VariableDescriptionDefault
TZContainer timezoneUTC
VERSIONDocker image version taglatest
WATCHTOWER_POLL_INTERVALPolling interval in seconds for the optional Docker Compose watchtower auto-update service3600

Paths ​

VariableDescriptionDefault
DATA_DIRDirectory for application data./data
CONFIG_DIRDocker Compose host directory mounted at /app/config for external tool configs (such as rclone and BaiduPCS-Go); platform configurations live in SQLite./config
OUTPUT_DIRInitial recording folder used only to seed global_config.output_folder when the standalone backend creates a fresh database; startup write probes and disk-space health checks read saved global_config.output_folder and overrides instead. Under Docker Compose this is the host bind-mount directory, while the container receives OUTPUT_DIR=/app/output. Existing database settings are preserved../output
LOG_DIRDirectory for log files. A relative value resolves against the process working directory; the bundled system service sets it to /var/log/rust-srec instead, so log files are stored outside the state directory. See Installation../logs
LOG_MAX_FILE_BYTESMaximum bytes per managed log segment, read at startup; integer from 1024 to 1073741824. Oversized records are truncated with a marker.16777216 (16 MiB)
LOG_MAX_FILESMaximum managed log segments including the current file, read at startup; integer from 2 to 1024. Use consistent settings for shared LOG_DIR; see retention limits.16

Initial and saved recording directories

The standalone backend initializes a fresh database's output_folder from OUTPUT_DIR, using ./output when unset or blank. It resolves relative paths against the startup working directory and saves an absolute path. Docker Compose and the systemd unit provide /app/output and /var/lib/rust-srec/output, respectively.

If initial migrations or saving the output folder fail, the next start resumes initialization with the absolute path selected on the first attempt, even if OUTPUT_DIR or the working directory changes.

Later starts preserve the saved setting. Change it under Settings → Global → Output Folder, with optional overrides per platform, template, and streamer. The resolved path shown by the application is authoritative. An existing binary or system-service installation that still has /app/output needs this setting changed to a writable directory.

Keep RUST_SREC_OUTPUT_ROOTS aligned with the saved folder when explicit boundaries are configured. Discovery uses saved output settings and overrides; a stale OUTPUT_DIR value does not add a second probe location after initialization.

Shutdown ​

VariableDescriptionDefault
RUST_SREC_SHUTDOWN_TIMEOUT_SECSStrict standalone-server shutdown deadline30
RUST_SREC_SHUTDOWN_FORCE_RESERVE_SECSTime reserved inside the deadline for forced process-tree containment; must be greater than zero and less than the total timeout2
RUST_SREC_CONTAINER_STOP_GRACE_PERIODDocker Compose wait before external SIGKILL; keep longer than the backend deadline35s
RUST_SREC_RUNTIME_MARKER_PATHDirty-generation marker retained after a forced or crashed runtimeBeside the SQLite database

The standalone backend allows 30 seconds for shutdown by default and reserves the final two seconds for forced process cleanup. Set the total with RUST_SREC_SHUTDOWN_TIMEOUT_SECS and keep the force reserve positive and below that total. Docker's stop grace period must be longer than the backend deadline.

A forced or crashed run leaves a recovery marker beside the database. Later clean exits do not clear earlier unresolved recovery. Remove the marker only while the backend is stopped and after checking interrupted files. Exit status 124 means the hard deadline expired; 125 means process-tree termination could not be requested. See runtime shutdown for signal and process-containment details.

Network ​

VariableDescriptionDefault
API_BIND_ADDRESSIP address the backend API binds to0.0.0.0
API_PORTExternal port for the backend API12555
FRONTEND_PORTExternal port for the web interface15275
BACKEND_URLInternal URL for the frontend to reach the backendhttp://rust-srec:8080
HTTP_PROXYProxy for plain HTTP requests, used where the proxy setting is System proxy-
HTTPS_PROXYProxy for HTTPS requests, used where the proxy setting is System proxy-
ALL_PROXYProxy for both when the more specific variable is not set-
NO_PROXYComma-separated list of hosts that bypass the proxy-

The proxy variables, in upper or lower case, take effect only where a global, platform, template, streamer, account, notification channel or upload step proxy setting is System proxy. Direct ignores them (except for the desktop app's update check), and FFmpeg and Streamlink are then started without them. The server reads them when it starts: restart it after changing them. rclone and BaiduPCS-Go are started without them too, and receive a saved proxy as HTTP_PROXY and HTTPS_PROXY. Email notifications never use a proxy. A new installation, or an upgrade from a version whose global proxy was turned off, that starts with HTTP_PROXY, HTTPS_PROXY or ALL_PROXY set makes System proxy the global default; see upgrading proxy settings.

Security & Auth ​

VariableDescriptionDefault
JWT_SECRETSecret key for JWT signing (Required unless using the local-only opt-out below)-
AUTH_DISABLEDDisable backend authentication for loopback-only local developmentfalse
API_CORS_ORIGINSComma-separated exact browser origins (scheme://host[:port]) allowed to call the API cross-origin while authentication is disabledLocal dev server and desktop webview origins
API_LOGIN_MAX_FAILURESFailed logins tolerated per account inside the window5
API_LOGIN_IP_MAX_FAILURESFailed logins tolerated per source address inside the window100
API_LOGIN_WINDOW_SECSLength of the failed-login window, in seconds900 (15m)
JWT_ISSUERJWT issuer identifierrust-srec
JWT_AUDIENCEJWT audience identifierrust-srec-api
SESSION_SECRETFrontend session encryption secret (Required, min 32 chars)-
COOKIE_SECURESet to true to force HTTPS-only cookies(auto)
CSRF_TRUSTED_ORIGINSComma-separated exact origins (scheme://host[:port]) the web interface accepts actions from besides its own address. Set on the frontend container-
MIN_PASSWORD_LENGTHMinimum length for user passwords8

The backend refuses to start without a non-empty JWT_SECRET. For local development only, authentication can be disabled by setting both AUTH_DISABLED=true and API_BIND_ADDRESS=127.0.0.1 (or ::1). The backend rejects this opt-out for wildcard, hostname, and non-loopback bind addresses.

While authentication is disabled, only the origins in API_CORS_ORIGINS may call the API from a browser; the default list covers http://localhost:15275, http://127.0.0.1:15275, http://[::1]:15275, tauri://localhost, and http://tauri.localhost. Set the variable to override it — entries must be exact origins with no trailing path, and malformed entries are skipped with a warning at startup. Requests from any other origin are refused with 403, as are requests whose Host header is neither a loopback name nor the configured bind address. With authentication enabled the variable is ignored and any origin may send requests, because every protected route still requires a bearer token.

The web interface refuses actions sent from any page other than its own, and answers them with Request refused: it did not come from this site. Browsers that send Sec-Fetch-Site (current browsers over HTTPS or on localhost) are checked by that header alone. Otherwise, as on plain HTTP at a LAN address or in older browsers, the web interface compares the page's address with the address the browser opened: the host and port from the Host header or, when a reverse proxy changes Host, from X-Forwarded-Host, and the scheme from X-Forwarded-Proto when it is sent. The forwarded host must include the port the browser used (in nginx, $http_host, not $host). A proxy that changes Host without sending X-Forwarded-Host then makes every action fail this way; forward the original Host with its port (or set X-Forwarded-Host), or list the address you open the web interface at in CSRF_TRUSTED_ORIGINS, for example https://srec.example.com. The proxy must also not strip the Referer header. Malformed entries are skipped with a warning at startup. The frontend container logs a refusal once per origin and host pair, for the first 100 pairs.

Login throttling ​

POST /api/auth/login counts failed attempts in a sliding window and answers 429 with a Retry-After delay once a budget is spent. Two budgets apply to every attempt:

  • Per account (API_LOGIN_MAX_FAILURES, default 5). A successful login clears it immediately.
  • Per source address (API_LOGIN_IP_MAX_FAILURES, default 100). This limit is higher to allow for shared proxies. The source address is the peer of the TCP connection, and X-Forwarded-For is not trusted, so behind the bundled frontend container, nginx, or any other reverse proxy every login arrives from the proxy's address. Treat this budget as a cap on password-hashing work, not as a per-user lockout — while it is exhausted, everyone behind that proxy is throttled. Raise it if that matters more to you than the hashing cap; lower it only if browsers reach the backend directly.

Both share the window length set by API_LOGIN_WINDOW_SECS.

Token Expiration ​

VariableDescriptionDefault
ACCESS_TOKEN_EXPIRATION_SECSJWT access token lifetime3600 (1h)
REFRESH_TOKEN_EXPIRATION_SECSJWT refresh token lifetime604800 (7d)
REFRESH_TOKEN_REUSE_GRACE_SECSSeconds after a refresh token is consumed during which a replay is rejected without revoking other sessions; see refresh token rotation0
REVOKE_ALL_ON_REFRESH_TOKEN_REUSERevoke all of the user's sessions when a consumed refresh token is replayed (true/false, also 1/0, yes/no, on/off; anything else counts as true)true

Browser Notifications (Web Push / VAPID) ​

VariableDescriptionDefault
WEB_PUSH_VAPID_PUBLIC_KEYVAPID public key (base64url, unpadded). Leave empty/unset to disable.-
WEB_PUSH_VAPID_PRIVATE_KEYVAPID private key (base64url, unpadded). Leave empty/unset to disable.-
WEB_PUSH_VAPID_SUBJECTVAPID subject (e.g. mailto:admin@localhost)mailto:admin@localhost

Backend Service ​

VariableDescriptionDefault
RUST_LOGLogging filter directive (trace, debug, info, warn, error, or target-specific directives). Docker Compose sets info by default; the standalone binary defaults to rust_srec=info,sqlx=warn,mesio_engine=info,flv=info,hls=info.rust_srec=info,sqlx=warn,mesio_engine=info,flv=info,hls=info (standalone) / info (Docker)
DATABASE_URLSQL database connection string. The value shown is the one the Docker .env sets. Left unset the backend falls back to sqlite:srec.db?mode=rwc, relative to the working directory; the bundled system service sets sqlite:///var/lib/rust-srec/rust-srec.db. The runtime generation marker is derived from this URL and is stored beside the database file.sqlite:///app/data/rust-srec.db (Docker)
RUST_SREC_LOCALELocale for backend-emitted notification strings. Affects every notification event — stream online/offline, download lifecycle, segments, pipeline jobs, system alerts, credential events. Supported: en, zh-CN.en
MIMALLOC_ALLOW_THPLinux only. Whether the backend's own memory may use transparent hugepages. The backend turns them off for itself unless this variable is set, because on hosts where transparent_hugepage is always they keep far more memory in use than the backend needs. FFmpeg, rclone and the other tools it starts keep the system's setting. Set 1 to let the backend use hugepages again.0
RUST_SREC_OUTPUT_ROOTSComma-separated list of absolute paths to treat as output-root boundaries for the write gate. If unset, the gate uses a heuristic that takes the first two named components of each resolved output path (e.g. /rec/huya for /rec/huya/X/20260415, /home/user for /home/user/recordings/X/20260415). Two named components is the smallest safe default — it avoids accidentally sharing a gate key across unrelated users in /home/... layouts. For a single-mount /rec-style layout where you want one gate key per mount (and therefore one aggregated notification on failure instead of one per platform), set this explicitly: RUST_SREC_OUTPUT_ROOTS=/rec.-

The heuristic groups deep paths under broader keys: /var/lib/rust-srec/output uses /var/lib. Startup discovery tests a concrete recording directory that resolves to that same key, so it does not require write access to a read-only ancestor. Setting RUST_SREC_OUTPUT_ROOTS=/var/lib/rust-srec/output gives the directory its own boundary; the longest matching configured prefix wins. Explicit boundaries are themselves probed and should name writable recording locations. See output-root probes for discovery limits.

External tools ​

VariableDescriptionDefault
FFMPEG_PATHFFmpeg binary used by pipeline processors, by the Streamlink engine when its configuration names no FFmpeg path, and by the FFmpeg download engine when its configuration names no binary path.ffmpeg
FFPROBE_PATHFFprobe binary used by the audio_extract processorffprobe
STREAMLINK_PATHStreamlink binary used to look up streams with Streamlink, and to check whether Streamlink can handle a URL when adding a streamer, unless streamlink.binary_path in the platform's settings names another. The Streamlink download engine uses the binary path in its own configuration.streamlink
RCLONE_PATHrclone binary used by the rclone processorrclone
BAIDUPCS_PATHBaiduPCS-Go binary, used when the preset sets no binary_pathBaiduPCS-Go
BAIDUPCS_GO_CONFIG_DIRConfig directory where BaiduPCS-Go stores its session and pcs_config.json (used when the preset sets no config_dir)BaiduPCS-Go default (/app/config/BaiduPCS-Go in Docker)
DANMAKU_FACTORY_PATHDanmakuFactory binary, used when the preset sets no binary_pathDanmakuFactory

A bare name is looked up on PATH. The Docker image bundles these tools.

Resource Limits (Docker) ​

VariableDescriptionDefault
CPU_LIMITMaximum CPUs the container can use4
MEMORY_LIMITMaximum memory the container can use4G
CPU_RESERVATIONReserved CPUs for the container1
MEMORY_RESERVATIONReserved memory for the container512M

Released under the MIT / Apache-2.0 License.