Skip to main content

moley.yml reference

Configuration File

All tunnel config lives in moley.yml in your project root. Global settings (API token) are in ~/.moley/config.yml.

moley.yml
tunnel:
name: "my-project"
persistent: false

ingress:
zone: "mydomain.com"
mode: subdomain
apps:
- target:
port: 3000
hostname: "localhost"
protocol: http
expose:
subdomain: "app" # app.mydomain.com

- target:
port: 8080
hostname: "localhost"
protocol: http
expose:
subdomain: "api" # api.mydomain.com

Tunnel

  • name — tunnel name (required). The actual Cloudflare tunnel is created as moley-{name}.
  • persistent — if true, the tunnel is kept alive when you stop. Defaults to false (tunnel + DNS cleaned up on stop).

Ingress Mode

Controls how DNS records are created. Two modes:

  • subdomain — creates one DNS record per app (api.domain.com, web.domain.com). Best for production.
  • wildcard — creates a single *.domain.com record. Cloudflared routes by hostname. Best for dev when apps change frequently.

Target Protocol

Each app target requires a protocol field:

  • http — standard HTTP (most common)
  • https — local service uses HTTPS
  • tcp — raw TCP (databases, custom protocols)

Global Config

~/.moley/config.yml
cloudflare:
token: "your-api-token"
Or use an environment variable
export MOLEY_CLOUDFLARE__TOKEN="your-api-token"

Zone

The zone is the Cloudflare-managed domain used for all subdomains.

Requirements
  • Domain must be on Cloudflare
  • DNS managed by Cloudflare (orange cloud enabled)
  • API token: Zone > Zone > Read, Zone > DNS > Edit, Account > Cloudflare Tunnel > Edit
Zone environment variable
export MOLEY_TUNNEL_INGRESS__ZONE="yourdomain.com"

Apps

Each app maps a local target (port + hostname) to a public expose (subdomain).

Full example
ingress:
zone: "yourdomain.com"
mode: subdomain
apps:
- target:
port: 3000
hostname: "localhost"
protocol: http
expose:
subdomain: "app" # app.yourdomain.com

- target:
port: 8080
hostname: "localhost"
protocol: http
expose:
subdomain: "api" # api.yourdomain.com

- target:
port: 5432
hostname: "127.0.0.1"
protocol: tcp
expose:
subdomain: "db" # db.yourdomain.com (TCP)

Environment variables

Use __ as the path separator and __N__ for array indexes (0-based).

Per-app overrides (MOLEY_TUNNEL_ prefix)
export MOLEY_TUNNEL_INGRESS__APPS__0__TARGET__PORT="3000"
export MOLEY_TUNNEL_INGRESS__APPS__0__TARGET__HOSTNAME="localhost"
export MOLEY_TUNNEL_INGRESS__APPS__0__EXPOSE__SUBDOMAIN="app"
info

To protect apps with Cloudflare Access, see Access and Policies.