{
	import conf/dynamic_dns.caddy
	import conf/auth.caddy
	import conf/geoip2.caddy
	# import conf/layer4.caddy
}

(unprotected) {
	{args[0]}.{$SUBDOMAIN}.{$DOMAIN} {
		log {
			output file /var/log/{args[0]}.log
		}
		reverse_proxy {args[1]}
	}
}

(protected) {
	{args[0]}.{$SUBDOMAIN}.{$DOMAIN} {
		import conf/authentik.caddy
		reverse_proxy {args[1]}
	}
}

import unprotected authentik host:19000
import unprotected vouch host:9090
import unprotected jellyfin host:8097
import unprotected seafile host:8082
import unprotected pgadmin host:5050
import unprotected homarr host:17575
import unprotected jellyseerr host:15055
import unprotected minio host:9000
import unprotected gitea host:3003
import unprotected minio-admin host:9001
import unprotected loki host:3100

import protected grafana host:3333
import protected sonarr host:18989
import protected radarr host:17878
import protected bazarr host:16767
import protected jackett host:9117
import protected dagster host:3000
import protected photoprism host:2342
import protected qbittorrent host:9092
import protected esp host:6052
import protected dsmr host:8888
import protected transmission host:9091
import protected droppy host:8989
import protected filebrowser host:8002
import protected jupyter host:9999
import protected nodered host:1880
import protected teslamate host:4000
import protected beszel host:8090

import sites/root.caddy
import sites/authentik.caddy
import sites/ha.caddy
import sites/tesla.caddy
import sites/geo.caddy
import sites/auth.caddy
import sites/test.caddy
