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