mirror of
https://github.com/vhaudiquet/homeprod.git
synced 2026-09-21 16:36:05 +00:00
15 lines
640 B
Bash
Executable File
15 lines
640 B
Bash
Executable File
#!/bin/bash
|
|
for filename in "$@"; do
|
|
if [[ "${filename}" =~ values.ya?ml$ ]] || [[ "${filename}" =~ secrets?.ya?ml$ ]] || [[ "${filename}" =~ .env$ ]]; then
|
|
# Skip files that are already SOPS-encrypted: sops -e -i refuses files
|
|
# containing a top-level 'sops' metadata block (YAML) or '#sops'
|
|
# comments (dotenv), and double-encrypting would corrupt them anyway.
|
|
# Makes the hook idempotent for encrypted-at-rest working trees.
|
|
if grep -qE '^(sops:|#sops)' "${filename}" 2>/dev/null; then
|
|
continue
|
|
fi
|
|
sops -e -i "${filename}"
|
|
git add "${filename}"
|
|
fi
|
|
done
|