From b720b35bd72b339b7766bcdec8e3912bfe1c9ef9 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Mon, 20 Feb 2023 12:04:09 -0800 Subject: [PATCH] feature: enable one-way encrypted secrets fixes #9 --- pkgs/agenix.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/agenix.sh b/pkgs/agenix.sh index c1e89c3..ab959ff 100644 --- a/pkgs/agenix.sh +++ b/pkgs/agenix.sh @@ -114,7 +114,7 @@ function edit { CLEARTEXT_DIR=$(@mktempBin@ -d) CLEARTEXT_FILE="$CLEARTEXT_DIR/$(basename "$FILE")" - if [ -f "$FILE" ] + if [ -f "$FILE" ] && [ -t 0 ] then DECRYPT=("${DEFAULT_DECRYPT[@]}") if [[ "${DECRYPT[*]}" != *"--identity"* ]]; then @@ -142,7 +142,7 @@ function edit { warn "$FILE wasn't created." return fi - [ -f "$FILE" ] && [ "$EDITOR" != ":" ] && @diffBin@ -q "$CLEARTEXT_FILE.before" "$CLEARTEXT_FILE" && warn "$FILE wasn't changed, skipping re-encryption." && return + [ -f "$FILE" ] && [ "$EDITOR" != ":" ] && [ -f "$CLEARTEXT_FILE.before" ] && @diffBin@ -q "$CLEARTEXT_FILE.before" "$CLEARTEXT_FILE" && warn "$FILE wasn't changed, skipping re-encryption." && return ENCRYPT=() while IFS= read -r key