Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ php artisan env:list

- `--region=`(optional) - The region the infrastructure resides in. If not given, or cannot be found, it will prompt the user for it.

- `--decrypt`(optional | Default: false) - Decrypt the values before pulling them.
> See more details about encrypt in the [AWS documentation](https://docs.aws.amazon.com/kms/latest/developerguide/services-parameter-store.html)
---

Both commands will use the env file respective to the stage argument. For example: with stage argument `production` it will work with the `.env.production` file. If the file exists when pulling, it will back up the existing file.
Expand Down
5 changes: 4 additions & 1 deletion src/Console/EnvList.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ class EnvList extends Command
{--appName=}
{--secretKey=}
{--accessKey=}
{--region=}';
{--region=}
{--decrypt}';

/**
* The console command description.
Expand All @@ -42,6 +43,8 @@ class EnvList extends Command
public function handle(): int
{
$this->stage = $this->argument('stage');
$this->decrypt = $this->option('decrypt') ? true : false;

$keyValues = $this->unifySplitValues($this->getEnvironmentVarsFromRemote()->sortKeys());

if ($this->option('key')) {
Expand Down
4 changes: 3 additions & 1 deletion src/Console/EnvPull.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class EnvPull extends Command
{--appName=}
{--secretKey=}
{--accessKey=}
{--region=}';
{--region=}
{--decrypt}';

/**
* The console command description.
Expand All @@ -41,6 +42,7 @@ class EnvPull extends Command
public function handle(): int
{
$this->stage = $this->argument('stage');
$this->decrypt = $this->option('decrypt') ? true : false;

$resolvedEnv = '';

Expand Down
4 changes: 3 additions & 1 deletion src/Console/EnvPush.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ class EnvPush extends Command
{--appName=}
{--secretKey=}
{--accessKey=}
{--region=}';
{--region=}
{--decrypt}';

/**
* The console command description.
Expand All @@ -41,6 +42,7 @@ class EnvPush extends Command
public function handle(): int
{
$this->stage = $this->argument('stage');
$this->decrypt = $this->option('decrypt') ? true : false;

if (!file_exists('.env.' . $this->stage)) {
throw new InvalidArgumentException("'.env.$this->stage' doesn't exists.");
Expand Down
5 changes: 4 additions & 1 deletion src/Traits/InteractsWithSSM.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,10 @@ private function getEnvironmentVarsFromFile(): Collection
*/
public function getEnvironmentVarsFromRemote(string $nextToken = null): Collection
{
$arguments = ['Path' => '/' . $this->getAppName() . '/' . $this->stage];
$arguments = [
'Path' => '/' . $this->getAppName() . '/' . $this->stage,
'WithDecryption' => $this->decrypt,
];

if ($nextToken) {
$arguments['NextToken'] = $nextToken;
Expand Down