summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-11-29 00:01:37 +0100
committertv <tv@krebsco.de>2019-11-29 13:21:04 +0100
commit70fa39607fa9f0d7df424588ae109968f0f876d1 (patch)
treec8e912bca0edb372d2669e7ad1e65ab08fd5d76a /lib
parent8de797dae0fcd1821d79c486abeffc536c2de643 (diff)
ssh: support using ssh-configured user
Let ssh use the user configured in its configuration files when the target user is set to the empty string. Closes https://github.com/krebs/krops/issues/2
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/default.nix b/lib/default.nix
index bed284d..9fdde0b 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -44,7 +44,7 @@ let {
mkTarget = s: let
default = defVal: val: if val != null then val else defVal;
- parse = lib.match "(([^@]+)@)?(([^:/]+))?(:([^/]+))?(/.*)?" s;
+ parse = lib.match "(([^@]*)@)?(([^:/]+))?(:([^/]+))?(/.*)?" s;
elemAt' = xs: i: if lib.length xs > i then lib.elemAt xs i else null;
in if lib.isString s then {
user = default (lib.getEnv "LOGNAME") (elemAt' parse 1);