#!/sbin/openrc-run
description="Cloudflare Tunnel for the YES site (outbound only)"
supervisor=supervise-daemon
command=/usr/bin/cloudflared
command_args="--no-autoupdate tunnel --metrics 127.0.0.1:20241 run --token-file /etc/yes-site/tunnel.token"
command_user="yes-site:yes-site"
pidfile="/run/${RC_SVCNAME}.pid"
no_new_privs=yes
respawn_delay=5
respawn_max=0
# systemd ConditionPathExists= twin: refuse to start without the token
required_files="/etc/yes-site/tunnel.token"

depend() {
	need net
	after yes-site
}
