# Dankserver Caddyfile
# Deploy: copy to /etc/caddy/Caddyfile on dankserver (host Caddy service)
# See ../docs/Dankserver/ for service documentation.
#
# Naming: flat franksdank.cloud scheme (see docs/Infrastructure/Domain-DNS.md).
# DNS for these names is served by the dnsmasq quadlet on dankclaw
# (dankclaw/dnsmasq/addn-hosts) and handed to LAN clients by the SURFboard
# G36 router (DNS Relay -> statically configured -> 192.168.0.143).
#
# Phase 1 uses explicit http:// site addresses (no TLS yet). Phase 2 drops
# the prefix and adds a wildcard Let's Encrypt cert via DNS-01 (Porkbun).

{
	admin off
	email admin@franksdank.cloud
}

# --- Bare-IP access (health checks, convenience) ---
:80 {
	redir http://dankserver.franksdank.cloud/ 302
}

# --- Homepage (password protected) ---
http://dankserver.franksdank.cloud {
	basicauth {
		dank $2a$14$REPLACE_WITH_HASH
	}
	root * /srv/homepage
	file_server
}

# --- Plex (existing, kept) ---
http://plex.franksdank.casa {
	reverse_proxy localhost:32400
}

http://plex.franksdank.cloud {
	reverse_proxy localhost:32400
}

# --- Calibre-Web (existing, kept) ---
http://books.franksdank.cloud {
	reverse_proxy localhost:8083
}

# --- OpenWebUI (live name from the host Caddyfile; LLM chat UI on this host) ---
http://llms.franksdank.cloud {
	reverse_proxy localhost:3000
}

# --- RomM ---
http://romm.franksdank.cloud {
	basicauth {
		dank $2a$14$REPLACE_WITH_HASH
	}
	reverse_proxy localhost:8085
}

# --- Copyparty ---
http://files.franksdank.cloud {
	basicauth {
		dank $2a$14$REPLACE_WITH_HASH
	}
	reverse_proxy localhost:3923
}

# --- Jellyfin ---
http://jellyfin.franksdank.cloud {
	reverse_proxy 127.0.0.1:8096

	transport http {
		versions h2c 1.1
	}
}

# --- *arr Stack ---
http://radarr.franksdank.cloud {
	reverse_proxy localhost:7878
}

http://sonarr.franksdank.cloud {
	reverse_proxy localhost:8989
}

http://lidarr.franksdank.cloud {
	reverse_proxy localhost:8686
}

http://readarr.franksdank.cloud {
	reverse_proxy localhost:8787
}

http://prowlarr.franksdank.cloud {
	reverse_proxy localhost:9696
}

http://qbittorrent.franksdank.cloud {
	reverse_proxy localhost:8080
}

# --- Optional: Jackett ---
# http://jackett.franksdank.cloud {
# 	reverse_proxy localhost:9117
# }

# --- Optional: Whisparr ---
# http://whisparr.franksdank.cloud {
# 	reverse_proxy localhost:6969
# }
