ctucx.git: nixfiles

ctucx' nixfiles

commit 310268a59c39dd568a88411859909c985f6d6b28
parent 4ae9d6393907a815357cf9186c8201d41b870220
Author: Leah (ctucx) <git@ctu.cx>
Date: Mon, 20 Nov 2023 13:24:05 +0100

secrets/agenix: add support to read age-privatekey vio `bitwarden-cli`
1 file changed, 9 insertions(+), 1 deletion(-)
M
secrets/agenix
|
10
+++++++++-
diff --git a/secrets/agenix b/secrets/agenix
@@ -8,7 +8,15 @@ trap "rm -f $tempfile" SIGINT SIGTERM ERR EXIT
 touch $tempfile
 chmod 600 $tempfile
 
-echo "$(pass agenix-privkey)" > $tempfile
+if [ -x "$(which bw)" ]; then
+	privkey=$(bw get notes ea70a317-7cac-455e-bee0-7c97d7505a7b)
+	if [ $? -ne 0 ]; then exit; fi;
+else
+	privkey=$(pass agenix-privkey)
+	if [ $? -ne 0 ]; then exit; fi;
+fi
+
+echo "${privkey}" > $tempfile
 
 cd "`git rev-parse --show-toplevel`/secrets"