Skip to main content

Environment variables

This page lists the environment variables that are useful for installing, operating, debugging, and packaging Toposync.

It is not a complete dump of every internal tuning flag. Prefer the UI and API for normal product configuration, and use environment variables for process-level behavior such as ports, data directories, auth mode, Docker builds, processing servers, and media runtime integration.

For installation commands, start with Choose your installation. For file paths, see File locations. For ports, see Ports.

How to use them

For one-off terminal runs:

TOPOSYNC_DATA_DIR=./toposync-data toposync serve

For long-running services, define the variables in the service manager, Docker Compose file, Home Assistant add-on environment, or Windows service installer.

Command-line flags should be preferred when a supported flag exists:

toposync serve --host 0.0.0.0 --port 8000 --data-dir ./toposync-data

Most common variables

VariableTypical valuePurpose
TOPOSYNC_DATA_DIR/data, ./toposync-dataOverrides where Toposync stores configuration, files, runtime data, and extension data.
TOPOSYNC_BACKEND_PORT8000Default port for toposync serve when --port is not passed.
TOPOSYNC_PROCESSING_PORT49321Default port for toposync processing-serve when --port is not passed.
TOPOSYNC_AUTH_MODEenforced, bypass, ingress, hybridSelects the authentication mode. Use bypass only for local development.
TOPOSYNC_FRONTEND_DIR/path/to/frontend/distUses an external built frontend instead of the packaged frontend. Mostly for development and packaging diagnostics.
TOPOSYNC_NO_FRONTEND1Disables frontend serving. Useful for API-only diagnostics.
TOPOSYNC_PROCESSING_USERNAMEtoposyncEnables Basic Auth for a processing server.
TOPOSYNC_PROCESSING_PASSWORDstrong passwordEnables Basic Auth for a processing server.
TOPOSYNC_STREAMING_FFMPEG_PATH/usr/bin/ffmpegPoints the streaming extension to an FFmpeg binary.
TOPOSYNC_VISION_ONNXRUNTIME_PROVIDERSCUDAExecutionProvider,CPUExecutionProviderOverrides ONNX Runtime provider order for advanced diagnostics.

Core runtime

VariableDefaultNotes
TOPOSYNC_DATA_DIRPlatform-specific data directorySame effect as --data-dir.
TOPOSYNC_BACKEND_PORT8000Used by toposync serve if --port is omitted.
TOPOSYNC_PROCESSING_PORT49321Used by toposync processing-serve if --port is omitted.
TOPOSYNC_ROLEAuto-selectedSet to processing by toposync processing-serve. Usually do not set manually.
TOPOSYNC_FRONTEND_DIRPackaged frontendOverrides the production frontend location.
TOPOSYNC_NO_FRONTENDNot setAny non-empty value disables frontend serving.
TOPOSYNC_EXTENSION_AUTO_INSTALL_ON_STARTUP1Set to 0 to disable extension auto-install checks on startup.
TOPOSYNC_ARTIFACT_MAX_BYTES_PER_PACKET134217728Advanced pipeline artifact transport limit.
TOPOSYNC_ARTIFACT_MAX_TOTAL_BYTES_PER_PIPELINE536870912Advanced per-pipeline artifact limit.
TOPOSYNC_ARTIFACT_MAX_TOTAL_BYTES_GLOBAL1073741824Advanced global artifact limit.

Authentication

VariableDefaultNotes
TOPOSYNC_AUTH_MODEenforcedUse enforced for normal installs, bypass for local development, ingress behind a trusted ingress proxy, or hybrid for Home Assistant hybrid access.
TOPOSYNC_AUTH_COOKIE_SECUREautoSet to true or false only when deployment requires an explicit cookie policy.
TOPOSYNC_AUTH_ACCESS_TTL_S1800Access token lifetime in seconds.
TOPOSYNC_AUTH_REFRESH_TTL_S7776000Refresh token lifetime in seconds.
TOPOSYNC_AUTH_PAIRING_TTL_S300Pairing code lifetime in seconds.
TOPOSYNC_AUTH_REFRESH_ROTATION_GRACE_S30Grace period for refresh rotation.
TOPOSYNC_AUTH_EVENT_ALLOWLISTBuilt-in defaultsAdvanced event-stream auth allowlist.
TOPOSYNC_AUTH_SCRYPT_NBuilt-in defaultAdvanced password hashing cost.
TOPOSYNC_AUTH_SCRYPT_RBuilt-in defaultAdvanced password hashing cost.
TOPOSYNC_AUTH_SCRYPT_PBuilt-in defaultAdvanced password hashing cost.

Ingress and Home Assistant authentication:

VariableDefaultNotes
TOPOSYNC_AUTH_INGRESS_USER_ID_HEADERx-remote-user-idHeader that identifies the ingress user.
TOPOSYNC_AUTH_INGRESS_USERNAME_HEADERx-remote-user-nameHeader that provides the username.
TOPOSYNC_AUTH_INGRESS_DISPLAY_NAME_HEADERx-remote-user-display-nameHeader that provides a display name.
TOPOSYNC_AUTH_INGRESS_ROLEownerRole assigned to ingress users.
TOPOSYNC_AUTH_INGRESS_TRUSTED_IPSLocalhost plus Home Assistant supervisor defaultsComma-separated trusted proxy IPs/hosts.
TOPOSYNC_AUTH_INGRESS_ENFORCE_TRUSTEDtrueRejects ingress headers from untrusted clients when enabled.

Processing servers

VariableDefaultNotes
TOPOSYNC_PROCESSING_USERNAMENot setEnables Basic Auth when set.
TOPOSYNC_PROCESSING_PASSWORDNot setEnables Basic Auth when set.
TOPOSYNC_PROCESSING_SERVER_IDDepends on installer/runtimeIdentifies a processing server for distributed routing and streaming host affinity.
TOPOSYNC_PROCESSING_STATUS_DIAGNOSTICS_TIMEOUT3.5Timeout used while collecting processing diagnostics.
TOPOSYNC_PROCESSING_OBSERVABILITY_FLUSH_INTERVAL_MSBuilt-in defaultAdvanced processing observability flush interval.
TOPOSYNC_PROCESSING_OBSERVABILITY_BATCH_SIZEBuilt-in defaultAdvanced processing observability batch size.
TOPOSYNC_PROCESSING_OBSERVABILITY_MAX_BUFFERBuilt-in defaultAdvanced processing observability buffer limit.

Docker and builds

VariableUsed byNotes
TOPOSYNC_PORTdocker-compose.ymlHost port mapped to container port 8000.
TOPOSYNC_DATA_VOLUMEdocker-compose.ymlHost path mounted at /data. Defaults to ./toposync-data.
TOPOSYNC_DOCKER_TARGETdocker-compose.ymlBuild target. Defaults to runtime-cpu; CUDA uses runtime-cuda.
TOPOSYNC_APT_PACKAGESDockerfileExtra Debian packages installed into the image, for example ffmpeg.
TOPOSYNC_EXTRA_WHEELSDockerfileExtra wheel patterns copied from /wheelhouse.
TOPOSYNC_EXTRA_PIP_PACKAGESDockerfileExtra Python packages installed at image build time.
TOPOSYNC_INSTALL_WHEELDockerfileMain wheel pattern installed from /wheelhouse.
TOPOSYNC_ENV_FILEscripts/dev.jsAlternative environment file for local development.

Home Assistant add-on

Most users should configure the add-on through the Home Assistant UI. These variables describe the runtime contract used by the add-on container.

VariableTypical valueNotes
TOPOSYNC_DEPLOYMENT_TARGEThome_assistant_addonMarks the runtime as the Home Assistant add-on.
TOPOSYNC_DATA_DIR/dataAdd-on data directory inside the container.
TOPOSYNC_AUTH_MODEhome_assistant_hybridLets ingress use Home Assistant auth while direct access keeps Toposync auth.
TOPOSYNC_HOME_ASSISTANT_CONNECTION_MODEsupervisorUses the Supervisor API from inside the add-on.
SUPERVISOR_TOKENProvided by Home AssistantToken injected by Supervisor; do not create it manually.
TOPOSYNC_ADDON_NETWORK_SNAPSHOT_PATH/data/runtime/streaming/addon-network.jsonRuntime snapshot used by streaming diagnostics.
TOPOSYNC_ADDON_PUBLIC_HOSTSLAN hostnames/IPsExtra hosts advertised for WebRTC and direct access.
TOPOSYNC_EXPECTED_DIRECT_API_PORT18756Port expected for direct UI/API proxy.
TOPOSYNC_EXPECTED_RTSP_PORT18758Port expected for RTSP output.
TOPOSYNC_EXPECTED_HLS_PORT18759Only expected when direct HLS mode is enabled.
TOPOSYNC_EXPECTED_WEBRTC_PORT18760Port expected for WebRTC/WHEP signaling.
TOPOSYNC_EXPECTED_WEBRTC_UDP_PORT18762Port expected for WebRTC UDP media.
TOPOSYNC_FAIL_STREAM_URLS_ON_PORT_MISMATCH1Fails unsafe streaming URLs when the add-on network mapping does not match.

Streaming

VariableDefaultNotes
TOPOSYNC_STREAMING_ENGINE_PATHAuto-download/cachePath to MediaMTX binary or directory containing it.
TOPOSYNC_STREAMING_ENGINE_CACHE_DIR~/.toposync/runtime or /data/runtime in containersCache root for downloaded MediaMTX.
TOPOSYNC_STREAMING_ENGINE_DOWNLOAD_BASE_URLBuilt-in upstreamMirror base URL for MediaMTX downloads.
TOPOSYNC_STREAMING_GO2RTC_PATHAuto-download/cache or /usr/local/bin/go2rtc in packaged imagesPath to go2rtc binary.
TOPOSYNC_STREAMING_GO2RTC_CACHE_DIR~/.toposync/runtimeCache root for downloaded go2rtc.
TOPOSYNC_STREAMING_GO2RTC_DOWNLOAD_BASE_URLBuilt-in upstreamMirror base URL for go2rtc downloads.
TOPOSYNC_STREAMING_FFMPEG_PATHffmpeg on PATHExplicit FFmpeg binary path.
TOPOSYNC_STREAMING_HLS_PUBLIC_MODEproxy in the add-onUse proxy for signed/proxied HLS URLs. Direct HLS is mainly diagnostic.
TOPOSYNC_STREAMING_WEBRTC_ADDITIONAL_HOSTSNot setComma-separated hosts advertised to WebRTC clients.
TOPOSYNC_STREAMING_WEBRTC_LOCAL_UDP_ADDRESSRuntime defaultStatic ICE UDP bind address, for example :18762.
TOPOSYNC_STREAMING_WEBRTC_LOCAL_TCP_ADDRESSNot setOptional ICE TCP bind address when UDP is blocked.
TOPOSYNC_STREAMING_ENABLE_BYPASS0Advanced bypass mode for streaming internals.
TOPOSYNC_STREAMING_FFMPEG_LOGLEVELwarningFFmpeg logging level.

Distributed streaming sync:

VariableNotes
TOPOSYNC_STREAMING_SYNC_CORE_URLOrigin URL for remote streaming host sync.
TOPOSYNC_CORE_URLFallback origin URL for remote streaming host sync.
TOPOSYNC_STREAMING_SYNC_BEARER_TOKENBearer token for sync auth.
TOPOSYNC_STREAMING_SYNC_USERNAMEUsername for sync auth.
TOPOSYNC_STREAMING_SYNC_PASSWORDPassword for sync auth.
TOPOSYNC_STREAMING_SYNC_INTERVAL_SECONDSSync poll interval.
TOPOSYNC_STREAMING_SYNC_TIMEOUT_SECONDSSync request timeout.

Cameras

VariableDefaultNotes
TOPOSYNC_CAMERA_SNAPSHOT_TTL_S0.8Snapshot cache time-to-live.
TOPOSYNC_CAMERA_SNAPSHOT_FFMPEG_CONCURRENCY2FFmpeg snapshot concurrency.
TOPOSYNC_ONVIF_DISCOVERY_TTL_S60Discovery cache time-to-live.
TOPOSYNC_ONVIF_DISCOVERY_SUPERVISOR_NETWORKtrueEnables Home Assistant supervisor-network discovery path.
TOPOSYNC_ONVIF_DISCOVERY_MULTICASTtrueEnables ONVIF multicast discovery.
TOPOSYNC_ONVIF_DISCOVERY_LIMITED_BROADCASTtrueEnables limited broadcast discovery.
TOPOSYNC_ONVIF_DISCOVERY_TARGETSNot setComma-separated manual ONVIF discovery targets.
TOPOSYNC_CAMERA_ONVIF_TIMEOUT_SRuntime defaultONVIF request timeout.
TOPOSYNC_RTSP_OPEN_TIMEOUT_MS8000RTSP open timeout.
TOPOSYNC_RTSP_READ_TIMEOUT_MS8000RTSP read timeout.

Vision

VariableNotes
TOPOSYNC_VISION_ONNXRUNTIME_PROVIDERSComma-separated ONNX Runtime provider order. Use only when diagnosing provider selection.
TOPOSYNC_VISION_MANIFESTS_DIRExtra directory for vision manifests.
TOPOSYNC_VISION_MANIFEST_PATHSExtra manifest files or directories.
TOPOSYNC_VISION_MODEL_SOURCE_<MODEL_ID>Per-model source override.
TOPOSYNC_VISION_MODEL_URL_<MODEL_ID>Per-model URL override.
TOPOSYNC_VISION_MODEL_PATH_<MODEL_ID>Per-model local path override.
TOPOSYNC_VISION_OFFICIAL_MODEL_SOURCE_DIRLocal directory for official model artifacts.
TOPOSYNC_VISION_OFFICIAL_MODEL_BASE_URLBase URL for official model artifacts.
TOPOSYNC_VISION_HF_EXPORT_PIP_SPECSAdvanced Hugging Face export dependencies.
TOPOSYNC_VISION_LOCAL_BUILDER_RUNTIMEAdvanced local model builder runtime.
TOPOSYNC_VISION_LOCAL_BUILDER_PYTHONAdvanced local model builder Python executable.
TOPOSYNC_VISION_LOCAL_BUILDER_IMAGEAdvanced local model builder image.
TOPOSYNC_VISION_RFDETR_PIP_SPECAdvanced RF-DETR dependency override.

Troubleshooting

An environment variable does nothing

Check whether the same setting was also passed as a command-line flag. For supported flags, the command line is usually clearer and easier to verify.

A service does not see the variable

Interactive shell variables do not automatically apply to system services, Docker containers, Windows services, or Home Assistant add-ons. Set the variable in the service definition or container configuration.

The UI is missing

Remove TOPOSYNC_NO_FRONTEND and any incorrect TOPOSYNC_FRONTEND_DIR, then restart toposync serve.

Processing server auth fails

Verify that the origin registration uses the same username and password configured with TOPOSYNC_PROCESSING_USERNAME and TOPOSYNC_PROCESSING_PASSWORD.