Skip to content

Commit

Permalink
[1.x] Renders error from the SecretCommand (#202)
Browse files Browse the repository at this point in the history
* Render error

* Exits with `1`.

* Apply fixes from StyleCI

* Update SecretCommand.php

Co-authored-by: Nuno Maduro <[email protected]>
Co-authored-by: StyleCI Bot <[email protected]>
Co-authored-by: Taylor Otwell <[email protected]>
  • Loading branch information
4 people authored Nov 18, 2022
1 parent e92b272 commit 01ecf3e
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions src/Commands/SecretCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
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 @@ -28,32 +27,12 @@ protected function configure()
/**
* Execute the command.
*
* @return void
* @return int
*/
public function handle()
{
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.');
}
Helpers::danger('Secrets have been deprecated. Instead, please utilize environment variables and / or encrypted environment files.');

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

0 comments on commit 01ecf3e

Please sign in to comment.