caddy: Replace option protocol with tls

This commit is contained in:
SebastianStork 2025-08-27 21:08:17 +02:00
parent 533f67e14b
commit db0569680e
2 changed files with 19 additions and 18 deletions

View file

@ -63,12 +63,9 @@ in
type = lib.types.port;
default = null;
};
protocol = lib.mkOption {
type = lib.types.enum [
"https"
"http"
];
default = "https";
tls = lib.mkOption {
type = lib.types.bool;
default = true;
};
extraReverseProxyConfig = lib.mkOption {
type = lib.types.lines;
@ -95,7 +92,10 @@ in
virtualHosts =
virtualHosts
|> lib.mapAttrs' (
_: value: lib.nameValuePair "${value.protocol}://${value.domain}" (mkVirtualHostConfig value)
_: value:
lib.nameValuePair (lib.optionalString (!value.tls) "http://" + value.domain) (
mkVirtualHostConfig value
)
);
};
}