Easily update your .env files when deploying
Installs: 18 405
Open Issues: 4
- php: >=7.4
- deployer/deployer: ^6.8
- symfony/console: ^4.4 || ^5.0
- symfony/dotenv: ^4.4 || ^5.0
- webmozart/assert: ^1.10
- phpunit/phpunit: ^9.5
- setono/code-quality-pack: ^2.1
This package is auto-updated.
Last update: 2023-02-27 20:00:51 UTC
If you use Deployer as your deployment tool
.env files to handle environment variables (i.e. Symfony) this library is for you.
Are you still accessing your server to update environment variables manually after a deployment? We also did that and that's the main reason why we built this library.
Now we have a very specific, but simple, strategy for updating the
.env files during deployment:
We do not share the
.env.localfiles as is the default by Deployer. Instead, we have a
.env.local.phpin each release folder.
When deploying we copy the
.env.[stage].localfile from the previous release (if there was a previous release, else we create it).
If you are deploying interactively (i.e. manually) you are presented with a dialog asking if you want to update any environment variables.
Finally we run
composer symfony:dump-env [stage]to generate the
.env.local.phpfile for the current release.
composer require setono/deployer-dotenv
deploy.php file require the recipe:
<?php namespace Deployer; require_once 'recipe/dotenv.php'; // ...
This will automatically hook into the default flow of Deployer.