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

@ -32,6 +32,13 @@
]; ];
}; };
forgejo = {
enable = true;
doBackups = true;
domain = "git.sstork.dev";
ssh.enable = true;
};
hedgedoc = { hedgedoc = {
enable = true; enable = true;
doBackups = true; doBackups = true;
@ -43,31 +50,25 @@
domain = "tools.sprouted.cloud"; domain = "tools.sprouted.cloud";
}; };
forgejo = {
enable = true;
doBackups = true;
domain = "git.sstork.dev";
ssh.enable = true;
};
openspeedtest = { openspeedtest = {
enable = true; enable = true;
domain = "speedtest.sprouted.cloud"; domain = "speedtest.sprouted.cloud";
}; };
caddy.virtualHosts = { caddy.virtualHosts = {
forgejo = {
inherit (config.custom.services.forgejo) domain port;
};
hedgedoc = { hedgedoc = {
inherit (config.custom.services.hedgedoc) domain port; inherit (config.custom.services.hedgedoc) domain port;
}; };
it-tools = { it-tools = {
inherit (config.custom.services.it-tools) domain port; inherit (config.custom.services.it-tools) domain port;
}; };
forgejo = {
inherit (config.custom.services.forgejo) domain port;
};
openspeedtest = { openspeedtest = {
inherit (config.custom.services.openspeedtest) domain port; inherit (config.custom.services.openspeedtest) domain port;
protocol = "http"; tls = false;
extraReverseProxyConfig = '' extraReverseProxyConfig = ''
request_buffers 35MiB request_buffers 35MiB
response_buffers 35MiB response_buffers 35MiB

View file

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