Created
May 5, 2024 22:27
-
-
Save koss822/fb42e5690e4d4a5f9c6c95e560f827a6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assume 'secrets.yaml' is the file containing sensitive content | |
PRE_CHANGE_HASH=$(sha256sum secrets.yaml | awk '{print $1}') | |
# Performing operations that might change secrets.yaml | |
POST_CHANGE_HASH=$(sha256sum secrets.yaml | awk '{print $1}') | |
if [ "$PRE_CHANGE_HASH" != "$POST_CHANGE_HASH" ]; then | |
sops --encrypt --age $(cat age.pub) secrets.yaml > secrets.enc.yaml | |
echo "Encrypted secrets as contents have changed." | |
else | |
echo "No change in secrets detected, skipping encryption." | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment