Forked from greg-1-anderson/lock-all-environments
Last active
March 28, 2018 20:36
-
-
Save kporras07/937758f3fdc80570bc2269fc8a8842fa to your computer and use it in GitHub Desktop.
Lock all of the environments for the given site, save for the live environment
This file contains 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/bash | |
SITE=$1 | |
USER=${2-demo} | |
BASE_PASSWORD=${3-secretsecret} | |
ALL_ENVS="$(terminus env:list $SITE --field=id | grep -v live)" | |
for ENV in $ALL_ENVS ; do | |
is_locked="$(terminus lock:info "$SITE.$ENV" --field=locked)" | |
if [[ "$is_locked" == "true" ]] ; then | |
echo "# $SITE.$ENV is already locked" | |
else | |
echo "# Locking $SITE.$ENV" | |
PASSWORD=$ENV$BASE_PASSWORD | |
terminus lock:enable "$SITE.$ENV" "$USER" "$PASSWORD" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment