Skip to content

Instantly share code, notes, and snippets.

@claraj
Created March 29, 2018 02:49
Show Gist options
  • Save claraj/5bf770d1cef45d51b0452fcc0dfeb627 to your computer and use it in GitHub Desktop.
Save claraj/5bf770d1cef45d51b0452fcc0dfeb627 to your computer and use it in GitHub Desktop.
hacky git hook to prevent commits if app.yaml contains real password
#!/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