Last active
November 12, 2021 20:52
-
-
Save greg-1-anderson/07d8488cb79d108503fa2923f7662aa9 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} | |
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" | |
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
For the lazy, to lock all environments across all sites: