From ba20fb12425f7c43e2fa9c4f37ce63c89e9b4d25 Mon Sep 17 00:00:00 2001 From: Joey Hafner Date: Tue, 27 Aug 2024 21:56:30 -0700 Subject: [PATCH] Update filter scripts to use absolute path of .sops.yaml --- .sops/decrypt-filter.sh | 2 ++ .sops/encrypt-filter.sh | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) mode change 100644 => 100755 .sops/decrypt-filter.sh mode change 100644 => 100755 .sops/encrypt-filter.sh diff --git a/.sops/decrypt-filter.sh b/.sops/decrypt-filter.sh old mode 100644 new mode 100755 index 46d6a088..f12cf230 --- a/.sops/decrypt-filter.sh +++ b/.sops/decrypt-filter.sh @@ -8,8 +8,10 @@ if [[ -f $HOME/.age/key ]]; then else echo "SOPS_AGE_KEY_FILE not found at $HOME/.age/key" echo "Cannot decrypt secrets." + exit 1 fi +REPO_ROOT="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/.." # Set input/output type FILE_EXT="${1##*.}" diff --git a/.sops/encrypt-filter.sh b/.sops/encrypt-filter.sh old mode 100644 new mode 100755 index f9d76aee..5911199b --- a/.sops/encrypt-filter.sh +++ b/.sops/encrypt-filter.sh @@ -11,6 +11,7 @@ else exit 1 fi +REPO_ROOT="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )/.." # Set input/output type FILE_EXT="${1##*.}" @@ -26,7 +27,7 @@ case $FILE_EXT in esac if [[ -z ${FILE_TYPE+x} ]]; then - sops --encrypt --config ../.sops.yaml /dev/stdin + sops --encrypt --config $REPO_ROOT/.sops.yaml /dev/stdin else - sops --encrypt --config ../.sops.yaml --input-type $FILE_TYPE --output-type json /dev/stdin + sops --encrypt --config $REPO_ROOT/.sops.yaml --input-type $FILE_TYPE --output-type json /dev/stdin fi \ No newline at end of file