Update filter scripts to use absolute path of .sops.yaml

This commit is contained in:
Joey Hafner 2024-08-27 21:56:30 -07:00
parent 64d94faf77
commit ba20fb1242
No known key found for this signature in database
2 changed files with 5 additions and 2 deletions

2
.sops/decrypt-filter.sh Normal file → Executable file
View File

@ -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##*.}"

5
.sops/encrypt-filter.sh Normal file → Executable file
View File

@ -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