Unfuck secrets

Don't worry why all the commit hashes suddenly changed, it's fine.

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-02-19 13:06:35 +00:00
parent 5f905e76c6
commit 7737abc45e
7 changed files with 205 additions and 32 deletions

View File

@@ -5,18 +5,18 @@ set -o errexit
set -o nounset
set -o pipefail
if [[ -z "$SOPS_AGE_KEY_FILE" ]]; then
echo "Please set the SOPS_AGE_KEY_FILE environment variable"
exit 1
fi
find . -type f -name 'sops.yaml' | while IFS= read -r sops_file; do
dir=$(dirname "$sops_file")
echo "$dir"
namespace=$(grep -A1 "namespaces:" "$sops_file" | tail -n1 | awk '{print $2}' | tr -d '&')
SOPS_AGE_KEY_FILE="./secrets/$namespace/key.txt"
export SOPS_AGE_KEY_FILE
find "$dir" -maxdepth 1 -type f -regextype posix-extended \
-regex '.+\.(yaml|yml|json|env|ini|bin)' \
! -name 'sops.yaml' | while IFS= read -r file; do
echo "$file"
sops --config "$sops_file" updatekeys "$file" -y
done
unset SOPS_AGE_KEY_FILE
done