Skip to content

Commit 538b8b4

Browse files
authored
nixos/wstunnel: improve assertions (NixOS#368755)
2 parents f199d57 + 1657098 commit 538b8b4

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

nixos/modules/services/networking/wstunnel.nix

+5-4
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ let
168168
};
169169

170170
localToRemote = lib.mkOption {
171-
description = ''Listen on local and forwards traffic from remote.'';
171+
description = "Listen on local and forwards traffic from remote.";
172172
type = lib.types.listOf (lib.types.str);
173173
default = [ ];
174174
example = [
@@ -468,10 +468,11 @@ in
468468

469469
(lib.mapAttrsToList (name: serverCfg: {
470470
assertion =
471-
(serverCfg.tlsCertificate == null && serverCfg.tlsKey == null)
472-
|| (serverCfg.tlsCertificate != null && serverCfg.tlsKey != null);
471+
serverCfg.enableHTTPS
472+
->
473+
(serverCfg.useACMEHost != null) || (serverCfg.tlsCertificate != null && serverCfg.tlsKey != null);
473474
message = ''
474-
services.wstunnel.servers."${name}".tlsCertificate and services.wstunnel.servers."${name}".tlsKey need to be set together.
475+
If services.wstunnel.servers."${name}".enableHTTPS is set to true, either services.wstunnel.servers."${name}".useACMEHost or both services.wstunnel.servers."${name}".tlsKey and services.wstunnel.servers."${name}".tlsCertificate need to be set.
475476
'';
476477
}) cfg.servers)
477478
++

0 commit comments

Comments
 (0)