# Caddy v2 configuration for local development (HTTPS on localhost)
# Reverse-proxy to the bot service and serve static assets.
# Uses Caddy's internal CA to generate a self-signed certificate for localhost.

# HTTP -> HTTPS redirect for local development
:80 {
	redir https://localhost{uri}
}

# Local HTTPS site with self-signed cert
localhost {
	encode zstd gzip
	# Issue a locally-trusted certificate via Caddy's internal CA
	tls internal

	# Serve static files under /static from the mounted volume
	handle_path /static* {
		root * /var/www/reminder-rs/static
		file_server
	}

	# Proxy everything else to the bot service inside the Docker network
	reverse_proxy bot:18920
}
