Skip to content

Commit

Permalink
nixos/wstunnel: improve assertions (NixOS#368755)
Browse files Browse the repository at this point in the history
  • Loading branch information
mweinelt authored Jan 5, 2025
2 parents f199d57 + 1657098 commit 538b8b4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions nixos/modules/services/networking/wstunnel.nix
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ let
};

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

(lib.mapAttrsToList (name: serverCfg: {
assertion =
(serverCfg.tlsCertificate == null && serverCfg.tlsKey == null)
|| (serverCfg.tlsCertificate != null && serverCfg.tlsKey != null);
serverCfg.enableHTTPS
->
(serverCfg.useACMEHost != null) || (serverCfg.tlsCertificate != null && serverCfg.tlsKey != null);
message = ''
services.wstunnel.servers."${name}".tlsCertificate and services.wstunnel.servers."${name}".tlsKey need to be set together.
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.
'';
}) cfg.servers)
++
Expand Down

0 comments on commit 538b8b4

Please sign in to comment.