[modules] vpn use hostName as fallback name
This commit is contained in:
@@ -5,7 +5,7 @@ with lib;
|
||||
let
|
||||
cfg = config.services.malobeo.vpn;
|
||||
peers = import ./peers.nix;
|
||||
myPeer = peers.${cfg.name};
|
||||
myPeer = if cfg.name == "" then peers.${config.networking.hostName} else peers.${cfg.name};
|
||||
|
||||
peerList = builtins.filter (peer: peer.role != myPeer.role) (builtins.attrValues peers);
|
||||
peerListWithEndpoint = map (host:
|
||||
@@ -14,7 +14,12 @@ let
|
||||
else
|
||||
host
|
||||
) peerList;
|
||||
filteredPeerlist = map (host: builtins.removeAttrs host [ "role" "ips" "listenPort" "publicIp" ] ) peerListWithEndpoint;
|
||||
filteredPeerlist = map (host: builtins.removeAttrs host [
|
||||
"role"
|
||||
"ips"
|
||||
"listenPort"
|
||||
"publicIp"
|
||||
] ) peerListWithEndpoint;
|
||||
in
|
||||
{
|
||||
options = {
|
||||
@@ -29,7 +34,7 @@ in
|
||||
default = "";
|
||||
type = types.str;
|
||||
description = ''
|
||||
Name of the host in peers.nix
|
||||
Name of the host in peers.nix, if empty uses hostname
|
||||
'';
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user