Skip to content

Commit

Permalink
Revert "[1.x] Renders error from the SecretCommand (#202)" (#204)
Browse files Browse the repository at this point in the history
This reverts commit 01ecf3e.
  • Loading branch information
joedixon authored Nov 22, 2022
1 parent 01ecf3e commit 8c987f5
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions src/Commands/SecretCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Laravel\VaporCli\Commands;

use Laravel\VaporCli\Helpers;
use Laravel\VaporCli\Manifest;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;

Expand All @@ -27,12 +28,32 @@ protected function configure()
/**
* Execute the command.
*
* @return int
* @return void
*/
public function handle()
{
Helpers::danger('Secrets have been deprecated. Instead, please utilize environment variables and / or encrypted environment files.');
Helpers::ensure_api_token_is_available();

$this->vapor->storeSecret(
Manifest::id(),
$this->argument('environment'),
$this->option('name') ?? Helpers::ask('Name'),
$this->option('value') ?? $this->determineValue()
);

Helpers::info('Secret stored successfully.');
Helpers::line('You should deploy the project using the "deploy" command to ensure the new secrets are available.');
}

return 1;
/**
* Determine the secret's value.
*
* @return string
*/
protected function determineValue()
{
return $this->option('file')
? file_get_contents($this->option('file'))
: Helpers::ask('Value');
}
}

0 comments on commit 8c987f5

Please sign in to comment.