mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-01-21 22:11:33 +01:00
caddy: Remove tls and reverse-proxy-config options for now
This commit is contained in:
parent
e46ae6297c
commit
2531d57194
1 changed files with 5 additions and 21 deletions
|
|
@ -48,13 +48,6 @@ in
|
|||
type = lib.types.port;
|
||||
default = null;
|
||||
};
|
||||
tls = lib.mkEnableOption "" // {
|
||||
default = true;
|
||||
};
|
||||
extraReverseProxyConfig = lib.mkOption {
|
||||
type = lib.types.lines;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
}
|
||||
)
|
||||
|
|
@ -132,20 +125,13 @@ in
|
|||
let
|
||||
mkHostConfig = value: ''
|
||||
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} {
|
||||
reverse_proxy localhost:${builtins.toString value.port} ${
|
||||
lib.optionalString (value.extraReverseProxyConfig != "") "{ ${value.extraReverseProxyConfig} }"
|
||||
}
|
||||
reverse_proxy localhost:${builtins.toString value.port}
|
||||
}
|
||||
'';
|
||||
in
|
||||
(values |> lib.map (value: mkHostConfig value) |> lib.concatLines)
|
||||
+ ''
|
||||
handle {
|
||||
respond 404
|
||||
}
|
||||
'';
|
||||
(values |> lib.map (value: mkHostConfig value) |> lib.concatLines) + "handle { respond 404 }";
|
||||
};
|
||||
};
|
||||
in
|
||||
|
|
@ -171,14 +157,12 @@ in
|
|||
virtualHosts =
|
||||
let
|
||||
mkHostConfig = value: {
|
||||
name = (lib.optionalString (!value.tls) "http://") + value.domain;
|
||||
name = value.domain;
|
||||
value = {
|
||||
logFormat = "output file ${config.services.caddy.logDir}/${value.domain}.log { mode 640 }";
|
||||
extraConfig = ''
|
||||
bind tailscale/${getSubdomain value.domain}
|
||||
reverse_proxy localhost:${builtins.toString value.port} ${
|
||||
lib.optionalString (value.extraReverseProxyConfig != "") "{ ${value.extraReverseProxyConfig} }"
|
||||
}
|
||||
reverse_proxy localhost:${builtins.toString value.port}
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue