Created
March 29, 2018 02:49
-
-
Save claraj/5bf770d1cef45d51b0452fcc0dfeb627 to your computer and use it in GitHub Desktop.
hacky git hook to prevent commits if app.yaml contains real password
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
#!/bin/sh | |
# | |
# Check the app.yaml and verify it uses the pretend password. | |
echo "this is a hook" | |
filename="app.yaml" | |
placeholder="db-password-here" | |
while IFS= read -r line; do | |
if [[ $line == *WISHLIST_DB_PW* ]]; then | |
echo $line | |
if [[ $line == *$placeholder* ]]; then | |
echo "app.yaml contains a placeholder password" | |
exit 0 | |
else | |
echo "app.yaml contains a real password. Will not commit." | |
exit 1 | |
fi | |
fi | |
done < "$filename" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment