Environment Variables

Environment Variables

Environment variables used by the rstream CLI and SDKs.


The rstream CLI and SDK helpers can be configured with environment variables. This is useful in stateless environments where a configuration file is not present or should not be written, such as CI jobs and ephemeral containers.

When both a CLI flag and an environment variable are provided for the same CLI setting, the flag takes precedence. For runtime resolution, explicit flags are read first, then environment variables, then the selected context and default context stored in the configuration file.

Shared runtime variables

VariableMeaning
RSTREAM_CONFIGPath to the CLI configuration file.
RSTREAM_CONTEXTName of the context to select.
RSTREAM_ENGINEEngine endpoint used for Engine API operations.
RSTREAM_AUTHENTICATION_TOKENAuthentication token used by the CLI and SDKs.
RSTREAM_MTLS_CERT_FILEClient certificate file for mTLS agent authentication.
RSTREAM_MTLS_KEY_FILEClient private key file for mTLS agent authentication.
HTTPS_PROXY, HTTP_PROXY, ALL_PROXY, NO_PROXYProcess proxy variables used only when the selected config enables transport.proxy.fromEnvironment.

RSTREAM_AUTHENTICATION_TOKEN and the mTLS certificate/key pair are mutually exclusive for the agent control-channel connection. When both mTLS variables are set, the CLI and SDK helpers authenticate that connection with the client certificate and do not use a stored token from the selected context. If RSTREAM_AUTHENTICATION_TOKEN is also set, resolution fails before connecting. Engine HTTP API requests use token authentication.

Go SDK transport helper

VariableMeaning
RSTREAM_QUIC_TRANSPORTWhen set to 1, Go SDK config helpers use QUIC as the client-to-edge tunnel transport. Persisted transport configuration uses transport.useQuic.

RSTREAM_QUIC_TRANSPORT changes only the client-to-edge session. It does not create a published QUIC tunnel; published tunnel protocol is still selected through tunnel properties such as protocol: quic or CLI protocol flags.

SDK package behavior

The JavaScript API packages use the shared variables above. @rstreamlabs/rstream reads RSTREAM_AUTHENTICATION_TOKEN. @rstreamlabs/tunnels reads RSTREAM_ENGINE and RSTREAM_AUTHENTICATION_TOKEN.

@rstreamlabs/runtime is the Node.js tunnel runtime package. It follows the runtime resolution model used by the native SDKs: explicit SDK options first, then environment variables, then the selected context from RSTREAM_CONFIG or the default ~/.rstream/config.yaml file. It reads RSTREAM_CONFIG, RSTREAM_CONTEXT, RSTREAM_ENGINE, RSTREAM_AUTHENTICATION_TOKEN, RSTREAM_MTLS_CERT_FILE, RSTREAM_MTLS_KEY_FILE, and RSTREAM_QUIC_TRANSPORT. QUIC transport is not supported by the JavaScript runtime package, so RSTREAM_QUIC_TRANSPORT=1 fails during configuration resolution.