Skip to content

feat: add named Cloudflare tunnel support#58

Open
ToRvaLDz wants to merge 2 commits intoArk0N:masterfrom
ToRvaLDz:master
Open

feat: add named Cloudflare tunnel support#58
ToRvaLDz wants to merge 2 commits intoArk0N:masterfrom
ToRvaLDz:master

Conversation

@ToRvaLDz
Copy link
Copy Markdown

@ToRvaLDz ToRvaLDz commented Apr 4, 2026

Summary

  • Adds a named tunnel mode alongside the existing quick (trycloudflare.com) tunnel
  • Ships a systemd service file (codeman-tunnel-named.service) for persistent named tunnels
  • All tunnel parameters are configurable via environment variables — no hardcoded values
  • Fully backward compatible: ./tunnel.sh [start|stop|status|url] still works as before

Usage

# First-time setup
cloudflared tunnel login
cloudflared tunnel create <tunnel-name>
cloudflared tunnel route dns <tunnel-name> <hostname>
./scripts/tunnel.sh named setup   # writes ~/.cloudflared/<tunnel-name>.yml

# Start / stop
./scripts/tunnel.sh named start
./scripts/tunnel.sh named stop
./scripts/tunnel.sh named enable  # start at boot

Environment variables

Variable Default Description
CLOUDFLARED_TUNNEL_NAME codeman Tunnel name (from cloudflared tunnel list)
CLOUDFLARED_TUNNEL_ID Tunnel UUID (from cloudflared tunnel list)
CODEMAN_TUNNEL_HOSTNAME codeman.example.com Public hostname to route

Test plan

  • ./tunnel.sh start still starts the quick tunnel (backward compat)
  • ./tunnel.sh named setup generates ~/.cloudflared/<tunnel-name>.yml correctly
  • ./tunnel.sh named start installs and starts the systemd service with the right tunnel name
  • ./tunnel.sh named enable enables the service at boot
  • Setting CLOUDFLARED_TUNNEL_NAME=mytunnel uses mytunnel.yml and run mytunnel

ToRvaLDz added 2 commits April 4, 2026 13:37
Add named tunnel mode alongside existing quick tunnel, with systemd
service and setup helper. Tunnel ID and hostname are configurable via
CLOUDFLARED_TUNNEL_ID and CODEMAN_TUNNEL_HOSTNAME env vars.
Add named tunnel mode alongside existing quick tunnel, with systemd
service and setup helper. All tunnel parameters are configurable via
environment variables:

  CLOUDFLARED_TUNNEL_NAME   — tunnel name (default: codeman)
  CLOUDFLARED_TUNNEL_ID     — tunnel UUID (from: cloudflared tunnel list)
  CODEMAN_TUNNEL_HOSTNAME   — public hostname

Backward compatible: ./tunnel.sh [start|stop|status|url] still works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant