nixos/wireguard-networkd: only set PresharedKey credential when given a file

This patch fixes an oversight in the initial implementation
of using systemd credentials in 6bc8dcc630
that would cause a warning to be logged about a missing credential
when presharedKeyFile wasn't set.
This commit is contained in:
networkException 2024-12-27 23:11:40 +01:00
parent 5ea8221772
commit e7e42de5a7
No known key found for this signature in database
GPG key ID: E3877443AE684391

View file

@ -61,7 +61,8 @@ let
interfaceName: peer:
removeNulls {
PublicKey = peer.publicKey;
PresharedKey = "@${presharedKeyCredential interfaceName peer}";
PresharedKey =
if peer.presharedKeyFile == null then null else "@${presharedKeyCredential interfaceName peer}";
AllowedIPs = peer.allowedIPs;
Endpoint = peer.endpoint;
PersistentKeepalive = peer.persistentKeepalive;