vkma.devRU

The vkma-tunnel configuration

On this page

The package looks for vkma-tunnel.config.{ts,mts,js,mjs,json}, walking up from the current directory to the root. The first file it finds wins. The priority of settings is: CLI flags and plugin options, then the file, then the defaults.

Example

TSvkma-tunnel.config.ts
import { defineTunnelConfig } from "@vkma.dev/tunnel";

export default defineTunnelConfig({
    provider: "opentunnel", // default; or "cloudflared"
    port: 5173, // default
    host: "localhost", // default
    // profile: "my-app", // default: project directory name
    // A provider's own options live in its section, never at the top:
    // opentunnel: {
    //     route: "@", // default https://<id>.opentunnel.xyz, or a subdomain label
    //     api: "https://opentunnel.example", // self-hosted server
    // },
});

A TypeScript config works without a build: Node >= 22.18 runs TypeScript directly.

Top level and provider sections

The top level holds only the keys that every provider understands. A provider’s own options live in its section, opentunnel or cloudflared. A section beside another provider is a config error. The package rejects a key the provider would ignore.

Key Meaning
provider opentunnel (default) or cloudflared
port the local port, 5173 by default
host the local host, localhost by default
profile the identity profile, by default the project directory name

port and host from the file apply to the CLI and the Node API. The plugin tunnels the live Vite server. For the plugin the project starts at the Vite root: config discovery and the default profile start there.

There is no environment layer. Two exceptions: TUNNEL_TOKEN with the Cloudflare token and OPENTUNNEL_API with the address of a self-hosted opentunnel server.

The keys of the sections are described on the provider pages: OpenTunnel, Cloudflare Tunnel.

Autocomplete in JSON

Add $schema to a JSON config, and the editor suggests the keys:

{}vkma-tunnel.config.json
{
    "$schema": "https://unpkg.com/@vkma.dev/tunnel/schema/vkma-tunnel.config.schema.json",
    "provider": "opentunnel",
}

The package ships the schema as @vkma.dev/tunnel/schema.

Next

vkma.dev
RU
Esc