Created
February 8, 2019 16:41
-
-
Save VivienLN/aecc327d5d4aa0e76195b50fb2bfe031 to your computer and use it in GitHub Desktop.
Setup .env values and salt generation for Wordplate (https://wordplate.github.io/docs/introduction)
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
| # Set .env values | |
| echo "Setting .env values..." | |
| for KEY in WP_PREFIX DB_HOST DB_NAME DB_USER DB_PASSWORD | |
| do | |
| DEFAULT=$(sed -n "s/^$KEY=\(.*\)/\1/p" .env) | |
| read -e -i $DEFAULT -p "$KEY: " VALUE | |
| [[ $VALUE ]] && sed -i "s/^$KEY=.*/$KEY=$VALUE/g" .env | |
| done | |
| # Generate salts | |
| # Note: Does not use aaemnnosttv/wp-cli-dotenv-command anymore because it breaks all the .env file... | |
| echo "Generating salts..." | |
| for KEY in AUTH_KEY SECURE_AUTH_KEY LOGGED_IN_KEY NONCE_KEY AUTH_SALT SECURE_AUTH_SALT LOGGED_IN_SALT NONCE_SALT | |
| do | |
| SALT=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1) | |
| sed -i "s/^$KEY=.*/$KEY=\"$SALT\"/g" .env | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment