diff options
author | tv <tv@krebsco.de> | 2017-12-29 11:56:38 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2017-12-29 12:11:10 +0100 |
commit | 508e2cea8b09fee3745d0c03ff8fdf64bed6c48c (patch) | |
tree | 9316d454d556d044e57e62f1051fb58e295dda33 | |
parent | a058a8d1f7cf77e4990e9c6c06c4a2681efbc47c (diff) |
main: default target {host,user} to origin'sv2.2.0
-rwxr-xr-x | bin/populate | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/bin/populate b/bin/populate index 7f43cf3..addd0d5 100755 --- a/bin/populate +++ b/bin/populate @@ -46,14 +46,16 @@ main() {( fi target=$( + export origin_host + export origin_user echo "$target_spec" | jq -R ' def default(value; f): if . == null then value else f end; def default(value): default(value; .); - match("^(?:([^@]+)@)?([^:/]+)(?::([^/]*))?(/.*)?") + match("^(?:([^@]+)@)?(?:([^:/]+))?(?::([^/]+))?(/.*)?") | { - user: .captures[0].string | default("root"), - host: .captures[1].string, + user: .captures[0].string | default(env.origin_user), + host: .captures[1].string | default(env.origin_host), port: .captures[2].string | default(22; if test("^[0-9]+$") then fromjson else error(@json "bad target port: \(.)") |