Appearance
How to update encrypted .env files
In case you need to change an environment variable (example is for staging environment, please use the environment name you need to update):
- Get an encryption key:
./deployer.phar env:encrypt-key:show staging - Decrypt:
php artisan env:decrypt --force --env staging --key - You should have the updated env file in
.env.staging - Update the
.env.stagingfile as you wish - Encrypt:
php artisan env:encrypt --force --env staging --key - Commit and push the changes
Security notes
The value of the LARAVEL_ENV_ENCRYPTION_KEY env var should be treated as a top-level secret and never be exposed on Slack, logs or other unsecure places.
Also, the unencrypted .env file should never be committed to git (it’s currently ignored by git), so make sure you’re only committing the encrypted env file.