{
	persist_config off

	servers {
		protocols h1 h2
	}

	cache {
		ttl 1h
		simplefs {
			configuration {
				path /data
				directory_size 900MB
			}
		}
		storers simplefs
	}
	log {
		format json
		exclude admin.api
	}

	order goatcounter after tracing

	metrics {
		per_host
	}

	acme_ca https://acme-api.actalis.com/acme/directory
	acme_eab {
		key_id {$EAB_KEY_ID}
		mac_key {$EAB_MAC_KEY}
	}

	storage redis {
		host redis.alin.ovh
		username default
		db 1
		password {$REDIS_PASSWORD}
		encryption_key {$REDIS_ENCRYPTION_KEY}
		tls_enabled true
		tls_insecure false
	}
}

(dns01) {
	tls {
		dns rfc2136 {
			key_name caddy
			key_alg hmac-sha512
			key {env.DDNS_TSIG_KEY}
			server pdns.alin.ovh:53
		}
	}
}

(cache) {
	cache
	header -Server
}

flynet-butterfly-1123.fly.dev {
	respond "Hello, world!"
}

alanpearce.eu {
	import cache

	goatcounter {
		api_host https://stats.alin.ovh
		site stats.alin.ovh
		token {$GOATCOUNTER_TOKEN}
	}

	reverse_proxy https://homestead-homestead488.danubedata.run {
		header_up Host {hostport}
	}
}

alin.ovh {
	@notgo {
		not query go-get=1
		not path /style.css /go/*
	}

	handle @notgo {
		redir https://alanpearce.eu{uri}
	}

	reverse_proxy https://homestead-homestead488.danubedata.run {
		header_up X-Forwarded-Host alanpearce.eu
		header_up Host alanpearce.eu
	}
}

www.alin.ovh, www.alanpearce.eu {
	redir https://alanpearce.eu{uri} permanent
}

zola-bearblog.alin.ovh,
zola-bearblog.alanpearce.eu {
	redir https://alinnow.codeberg.page/zola-bearblog{uri} permanent
}
