Skip to main content

Environment Variables

List of environment variables supported by the tuna client.

Global​

NameDescription
TUNA_CONFIGPath to the configuration file
TUNA_LOGPath to the log file: /file/to/file.log, stdout, stderr (default "stdout")
TUNA_LOG_LEVELLogging level: debug, info, warn, error, fatal (default "info")
TUNA_LOG_FORMATLogging format: text, json (default "text")
TUNA_TUITurn the terminal interface on (1) or off (0)
TUNA_NO_PROMPTNever ask questions such as delete confirmations: a command without --yes fails, as it does without a terminal

Common​

NameDescription
TUNA_PORTPort or destination address (e.g., 8080 or 10.0.0.10:5432)
TUNA_TOKENToken for creating a tunnel
TUNA_LOCATIONConnection region (nl or ru)
TUNA_API_KEYAPI key

For HTTP tunnels​

NameDescription
TUNA_BASIC_AUTHAdd basic authentication (e.g., user:pass)
TUNA_CIDR_ALLOWReject connections that do not match the specified CIDR
TUNA_CIDR_DENYReject connections that match the specified CIDR
TUNA_CORSEnable CORS headers and automatic OPTIONS request handling
TUNA_DOMAINReserved domain
TUNA_FILE_SERVERPath to directory for publishing files via HTTP
TUNA_FILE_SERVER_SPAPath to directory for publishing SPA site
TUNA_HTTPS_REDIRECTRedirect requests to HTTPS (true or false)
TUNA_INSPECTEnable or disable request inspector (true or false)
TUNA_INSPECT_ADDRSet address for the request inspector
TUNA_KEY_AUTHAdd authentication key passed in X-Token header
TUNA_POLICY_FILEPath to configuration file with rules (default .tuna.yml)
TUNA_POLICY_URLURL of a rules file in YAML or JSON (https only)
TUNA_QR_CODEGenerate and display QR code
TUNA_RATE_LIMITLimit the number of requests to your application (e.g., 20 for 20 requests/sec)
TUNA_REQUEST_HEADERAdd headers to pass to local service (e.g., host:tuna.am)
TUNA_RESPONSE_HEADERAdd headers to pass to client (e.g., env:test)
TUNA_SUBDOMAINReserved subdomain
TUNA_TLS_SKIP_VERIFYSkip TLS verification
TUNA_VERIFY_WEBHOOKVerify if webhooks are signed by this provider (e.g., gitlab)
TUNA_VERIFY_WEBHOOK_SECRETSecret used by the provider to sign webhooks, if any
TUNA_WEBDAVPath to directory for publishing files via WebDAV

For TCP tunnels​

NameDescription
TUNA_TCP_PORTReserved port number or alias
TUNA_QR_CODEGenerate and display QR code
TUNA_CIDR_ALLOWReject connections that do not match the specified CIDR
TUNA_CIDR_DENYReject connections that match the specified CIDR

For SSH tunnels​

NameDescription
TUNA_TCP_PORTReserved port number or alias
TUNA_SSH_AUTHSet static username/password
TUNA_SSH_PASSWORD_AUTHEnable or disable login/password authentication
TUNA_RECORD_SESSIONSSH session recording
TUNA_CIDR_ALLOWReject connections that do not match the specified CIDR
TUNA_CIDR_DENYReject connections that match the specified CIDR

For TRIGGER tunnels​

NameDescription
TUNA_TCP_PORTReserved port number or alias
TUNA_TRIGGER_SMTP_USERNAMEUsername for SMTP connection
TUNA_TRIGGER_SMTP_PASSWORDUser password for SMTP connection
TUNA_TRIGGER_SMTP_LISTEN_ADDRESSLocal address of the trigger SMTP server (default "127.0.0.1:1025")
TUNA_TRIGGER_WEBHOOK_SECRETSecret to be verified against X-Webhook-Secret header value

For Postgres/Redis tunnels​

NameDescription
TUNA_TCP_PORTReserved port number or alias
TUNA_QR_CODEGenerate and display QR code
TUNA_INSPECTEnable or disable request inspector (true or false)
TUNA_INSPECT_ADDRSet address for the request inspector
TUNA_CIDR_ALLOWReject connections that do not match the specified CIDR
TUNA_CIDR_DENYReject connections that match the specified CIDR

For Kubernetes tunnels​

NameDescription
KUBECONFIGPath to the kubeconfig (a single file)
TUNA_K8S_CONTEXTKubeconfig context (current-context by default)
TUNA_K8S_SERVICE_ACCOUNTService account for the guest ([namespace/]name)
TUNA_K8S_NAMESPACERestrict access to a single namespace
TUNA_K8S_PRESETRestriction preset: view, observer, debug, open
TUNA_K8S_READ_ONLYAllow read requests only
TUNA_K8S_NO_DELETEDeny deleting resources
TUNA_K8S_DENY_RESOURCEDenied resources (for example, secrets,configmaps)
TUNA_K8S_DENY_SUBRESOURCEDenied subresources (exec, attach, portforward, log, proxy)
TUNA_K8S_TTLAccess lifetime (for example, 4h, 0 means no limit)
TUNA_K8S_DOWNLOAD_LIMITHow many times the kubeconfig can be downloaded (0 means no limit)

For 1C publication​

The HTTP tunnel variables for access, address and the inspector work as well.

NameDescription
TUNA_1C_HOME1C:Enterprise installation directory
TUNA_1C_PLATFORM1C platform bitness: x64 or x86
TUNA_1C_PORTLocal port of the web server (a random free port by default)
TUNA_1C_PUBLISH_DIRDirectory with the publication files

Service creation and management​

NameDescription
TUNA_SERVICE_NAMEService name
TUNA_SERVICE_INSTALL_USERUser under which the service will run
TUNA_SERVICE_INSTALL_PASSWORDPassword when specifying a different user (Windows only)

Multiple tunnel startup​

NameDescription
TUNA_START_TUNNELS_FILEPath to configuration file with tunnels (default .tuna.yml)
TUNA_STARTTunnel name to start
TUNA_START_TAGSTunnel tags to start
TUNA_START_ALLStart all tunnels

Port detection​

NameDescription
TUNA_DETECT_SECONDSTime interval allocated for port detection

Secrets​

NameDescription
TUNA_SECRETS_SCOPEDirectory configuration for scope (default .)
TUNA_SECRETS_PROJECTProject alias
TUNA_SECRETS_CONFIGConfiguration alias
TUNA_SECRETS_FORMATOutput format (json, yaml, env, env-no-quotes or docker) (default json)
TUNA_SECRETS_NO_FILEPrint to stdout (default false)
TUNA_SECRETS_WATCHAutomatically restart process when secrets change (default false)
TUNA_SECRETS_NO_INTERACTIVEFail instead of prompting for project and config in tuna secrets setup (default false)
TUNA_SECRETS_FALLBACK_PASSPHRASEPassphrase for the tuna secrets run offline fallback file
TUNA_SECRETS_MOUNT_PATHPath to the secrets file with tuna secrets run --mount. The client sets this variable for the child process

Working with direnv​

direnv is an environment variable manager for the terminal. It allows you to automatically load and unload environment variables depending on the current directory – this allows you to have environment variables specific to each project you work on.

Before each prompt, direnv checks for the presence of a .envrc file in the current and parent directories, and if the file exists, it is loaded into a bash subshell, and all exported variables are then captured by direnv and become available to the shell.

Before using direnv, you need to install it. Installation instructions are available in the official documentation. After that, create a .envrc file in your project directory with tuna settings, for example:

export TUNA_PORT=8080
export TUNA_SUBDOMAIN=my-project

When navigating to the project directory and running the tuna http command, a tunnel will be created with the settings from the .envrc file:

% tuna http
INFO[13:00:00] Welcome to Tuna
INFO[13:00:00] Account: test (Paid till 05.04.2024)
INFO[13:00:00] Web Interface: http://127.0.0.1:4040
INFO[13:00:00] Forwarding https://my-project.ru.tuna.am -> 127.0.0.1:8080