settings
Environment-driven configuration.
Environment-driven configuration.
Every setting is read once, at import time, from the process environment. Each attribute below names the variable it reads and the default that applies when the variable is unset.
attributePREFIX= _prefix()URL prefix the broker is mounted under, from SUBFOLDER (default /streaming/), normalized.
attributeHOST= os.environ.get('BROKER_HOST', '127.0.0.1')Address uvicorn binds to, from BROKER_HOST (default 127.0.0.1).
attributePORT= int(os.environ.get('BROKER_PORT', '8000'))Port uvicorn listens on, from BROKER_PORT (default 8000).
attributeBROKER_SECRET= os.environ.get('BROKER_SECRET', '')Shared secret for the session lifecycle endpoints, from BROKER_SECRET; unset disables auth.
attributeSELKIES_TOKEN_URLS= [f'{_control_url}/api/tokens', f'{_control_url}/tokens']Candidate selkies token endpoints, both paths under SELKIES_CONTROL_URL.
attributeSELKIES_MASTER_TOKEN= os.environ.get('SELKIES_MASTER_TOKEN', '')Bearer token for the selkies token endpoint, from SELKIES_MASTER_TOKEN (default empty).
attributeROM_ROOT= Path(os.environ.get('ROM_ROOT', '/romm'))ROM library root, from ROM_ROOT (default /romm); activate rejects paths outside it.
attributeEXPORT_DIR= Path(os.environ.get('BROKER_EXPORT_DIR', '/config/broker-exports'))Where exit writes its save archives, from BROKER_EXPORT_DIR (default /config/broker-exports).
Written always in dev mode, otherwise only when the upload to the callback origin fails.
attributeIMPORT_DIR= Path(os.environ.get('BROKER_IMPORT_DIR', '/config/broker-imports'))Where the parent uploads archives to restore, from BROKER_IMPORT_DIR.
Defaults to /config/broker-imports; activate's save.archive path points
into here.
attributeSAVE_UPLOAD_PATH= os.environ.get('BROKER_SAVE_UPLOAD_PATH', '/api/webstation/saves')Exit upload target path, from BROKER_SAVE_UPLOAD_PATH (default /api/webstation/saves).
Appended to the callback base URL, which is the parent origin derived at activate unless the payload supplies one.
attributeSAVE_UPLOAD_TIMEOUT= float(os.environ.get('BROKER_SAVE_UPLOAD_TIMEOUT', '30'))Seconds allowed for the exit upload, from BROKER_SAVE_UPLOAD_TIMEOUT (default 30).
attributeFRONTEND_DIST= Path(os.environ.get('BROKER_FRONTEND_DIST', '/usr/share/webstation-broker/www'))Built frontend served in non-dev mode, from BROKER_FRONTEND_DIST.
Defaults to /usr/share/webstation-broker/www; ignored when vite serves the
page.
attributeSTATE_FILE_MAX_BYTES= int(os.environ.get('BROKER_STATE_FILE_MAX_BYTES', str(256 * 1024 * 1024)))Ceiling on a single state file moving either way over the state-file routes.
From BROKER_STATE_FILE_MAX_BYTES (default 256 MiB). RomM caps its side of
the same transfer, so raising one without the other just moves which end
refuses.
attributeSAVE_FILE_MAX_ENTRIES= int(os.environ.get('BROKER_SAVE_FILE_MAX_ENTRIES', '10000'))Ceiling on the number of members a save/memory-card archive may contain.
Independent of SAVE_FILE_MAX_BYTES: a byte-size cap alone doesn't stop an
archive of huge numbers of near-zero-byte deeply-nested entries from
exhausting inodes or hanging the restore walk.
attributeSTATE_SCREENSHOT_MAX_BYTES= int(os.environ.get('BROKER_STATE_SCREENSHOT_MAX_BYTES', str(16 * 1024 * 1024)))Same two-sided cap for the frame served alongside a state.
From BROKER_STATE_SCREENSHOT_MAX_BYTES (default 16 MiB). Matches RomM's own
ceiling on the transfer.
attributeDEV_MODE= os.environ.get('BROKER_DEV_MODE', '').lower() == 'true'Whether dev mode is on, from BROKER_DEV_MODE (default off; only the string true enables it).
attributeGAMEPAD_SLOTS= int(os.environ.get('BROKER_GAMEPAD_SLOTS', '4'))Number of virtual gamepad slots, from BROKER_GAMEPAD_SLOTS (default 4).
func_prefix() -> strReturn the normalized URL prefix the broker is served under, e.g. /streaming.
Read from SUBFOLDER, which also drives the nginx templating and the vite
base. A missing leading slash is added and any trailing slash is dropped.
Returns
strThe prefix with a leading slash and no trailing slash, or an empty string