caddy: Remove tls and reverse-proxy-config options for now

This commit is contained in:
SebastianStork 2025-10-09 20:17:50 +02:00
parent e46ae6297c
commit 2531d57194

View file

@ -48,13 +48,6 @@ in
type = lib.types.port; type = lib.types.port;
default = null; default = null;
}; };
tls = lib.mkEnableOption "" // {
default = true;
};
extraReverseProxyConfig = lib.mkOption {
type = lib.types.lines;
default = "";
};
}; };
} }
) )
@ -132,20 +125,13 @@ in
let let
mkHostConfig = value: '' mkHostConfig = value: ''
import subdomain-log ${value.domain} import subdomain-log ${value.domain}
@${getSubdomain value.domain} host ${(lib.optionalString (!value.tls) "http://") + value.domain} @${getSubdomain value.domain} host ${value.domain}
handle @${getSubdomain value.domain} { handle @${getSubdomain value.domain} {
reverse_proxy localhost:${builtins.toString value.port} ${ reverse_proxy localhost:${builtins.toString value.port}
lib.optionalString (value.extraReverseProxyConfig != "") "{ ${value.extraReverseProxyConfig} }"
}
} }
''; '';
in in
(values |> lib.map (value: mkHostConfig value) |> lib.concatLines) (values |> lib.map (value: mkHostConfig value) |> lib.concatLines) + "handle { respond 404 }";
+ ''
handle {
respond 404
}
'';
}; };
}; };
in in
@ -171,14 +157,12 @@ in
virtualHosts = virtualHosts =
let let
mkHostConfig = value: { mkHostConfig = value: {
name = (lib.optionalString (!value.tls) "http://") + value.domain; name = value.domain;
value = { value = {
logFormat = "output file ${config.services.caddy.logDir}/${value.domain}.log { mode 640 }"; logFormat = "output file ${config.services.caddy.logDir}/${value.domain}.log { mode 640 }";
extraConfig = '' extraConfig = ''
bind tailscale/${getSubdomain value.domain} bind tailscale/${getSubdomain value.domain}
reverse_proxy localhost:${builtins.toString value.port} ${ reverse_proxy localhost:${builtins.toString value.port}
lib.optionalString (value.extraReverseProxyConfig != "") "{ ${value.extraReverseProxyConfig} }"
}
''; '';
}; };
}; };