caddy support multi domain

This commit is contained in:
pazpi 2025-01-06 18:24:12 +01:00
parent f15e521895
commit fdcc829acf
13 changed files with 344 additions and 141 deletions

View file

@ -26,6 +26,14 @@ in
'';
};
subdomain = lib.mkOption {
default = "prometheus";
type = lib.types.str;
description = ''
The subdomain where Prometheus is reachable
'';
};
host = lib.mkOption {
default = "localhost";
type = lib.types.str;
@ -94,9 +102,9 @@ in
(lib.mkIf cfg.proxy.enable {
services.caddy = with cfg.proxy; {
virtualHosts."prometheus.${domain}".extraConfig = ''
virtualHosts."${subdomain}.${domain}".extraConfig = ''
reverse_proxy http://${host}:9090
import cloudflare
import cloudflare_${domain}
'';
};
})