#!/bin/bash
set -euo pipefail
mkdir -p /etc/cloudflared
cat >/etc/cloudflared/config.yml <<'EOF'
ingress:
  - hostname: billing.woyla.net
    service: http://127.0.0.1:80
    originRequest:
      noTLSVerify: true
      connectTimeout: 30s
  - hostname: pay.woyla.net
    service: http://127.0.0.1:80
    originRequest:
      noTLSVerify: true
      connectTimeout: 30s
  - hostname: woyla.net
    service: http://127.0.0.1:80
    originRequest:
      connectTimeout: 30s
  - hostname: www.woyla.net
    service: http://127.0.0.1:80
    originRequest:
      connectTimeout: 30s
  - service: http_status:404
EOF
chmod 644 /etc/cloudflared/config.yml
systemctl restart cloudflared
sleep 4
journalctl -u cloudflared -n 25 --no-pager
