diff --git a/homelab/.sops/decrypt-in-place.sh b/homelab/.sops/decrypt-filter.sh similarity index 100% rename from homelab/.sops/decrypt-in-place.sh rename to homelab/.sops/decrypt-filter.sh diff --git a/homelab/.sops/encrypt-in-place.sh b/homelab/.sops/encrypt-filter.sh similarity index 60% rename from homelab/.sops/encrypt-in-place.sh rename to homelab/.sops/encrypt-filter.sh index fdd8802a..cf8e799b 100755 --- a/homelab/.sops/encrypt-in-place.sh +++ b/homelab/.sops/encrypt-filter.sh @@ -1,11 +1,6 @@ #!/bin/bash -# Takes one file path as input -# Outputs to a new file named `$1.enc` - -# if [ "$#" -ne 1 ]; then -# echo "Usage: $0 " -# exit 1 -# fi +# Takes input on stdin +# Outputs to stdout # Set age directory and default recipients AGE_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) @@ -19,8 +14,4 @@ if [[ -f $HOST_AGE_PUBKEY ]]; then SOPS_AGE_RECIPIENTS="$SOPS_AGE_RECIPIENTS,$(<$HOST_AGE_PUBKEY)" fi -FILE_EXT=${FILE_PATH##*.} -FILE_NAME=${FILE_PATH%%.*} -OUTPUT_FILE="$FILE_NAME.enc.$FILE_EXT" - -sops --encrypt --age ${SOPS_AGE_RECIPIENTS} -i $FILE_PATH \ No newline at end of file +sops --encrypt --age ${SOPS_AGE_RECIPIENTS} /dev/fd/3 \ No newline at end of file