mirror of
https://cgit.krebsco.de/krops/
synced 2025-01-27 10:29:25 +00:00
lib: add isLocalTarget
This commit is contained in:
parent
9677846bf5
commit
e8505f71ff
@ -34,6 +34,12 @@ let {
|
|||||||
if lib.length y != 1 then throw "malformed /etc/hostname" else
|
if lib.length y != 1 then throw "malformed /etc/hostname" else
|
||||||
lib.elemAt y 0;
|
lib.elemAt y 0;
|
||||||
|
|
||||||
|
isLocalTarget = let
|
||||||
|
origin = lib.mkTarget "";
|
||||||
|
in target:
|
||||||
|
target.user == origin.user &&
|
||||||
|
lib.elem target.host [origin.host "localhost"];
|
||||||
|
|
||||||
mkTarget = s: let
|
mkTarget = s: let
|
||||||
default = defVal: val: if val != null then val else defVal;
|
default = defVal: val: if val != null then val else defVal;
|
||||||
parse = lib.match "(([^@]+)@)?(([^:/]+))?(:([^/]+))?(/.*)?" s;
|
parse = lib.match "(([^@]+)@)?(([^:/]+))?(:([^/]+))?(/.*)?" s;
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
let
|
let
|
||||||
lib = import ../../lib // {
|
lib = import ../../lib;
|
||||||
isLocalTarget = let
|
|
||||||
origin = lib.mkTarget "";
|
|
||||||
in target:
|
|
||||||
target.host == origin.host &&
|
|
||||||
target.user == origin.user;
|
|
||||||
};
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{ nix, openssh, populate, writeDash, writeJSON }: let
|
{ nix, openssh, populate, writeDash, writeJSON }: let
|
||||||
|
Loading…
Reference in New Issue
Block a user