-
-
Save vnext-nguyen-quyen/78fba591467eb88e251589a82115fd0d to your computer and use it in GitHub Desktop.
Generate Laravel .env file from AWS Parameters Store
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 | |
PARAMATER="laravel-env" | |
REGION="eu-central-1" | |
WEB_DIR="/var/www/laravel" | |
WEB_USER="www-data" | |
# Get parameters and put it into .env file inside application root | |
aws ssm get-parameter --with-decryption --name $PARAMATER --region $REGION --query Parameter.Value | sed -e 's/^"//' -e 's/"$//' -e 's/\\n/\n/g' -e 's/\\//g' > $WEB_DIR/.env | |
# Clear laravel configuration cache | |
cd $WEB_DIR | |
chown $WEB_USER. .env | |
sudo -u $WEB_USER php artisan config:clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment