Skip to content

[FrameworkBundle] Adding better output to secrets:decrypt-to-local command #35285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 10, 2020
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int

$secrets = $this->vault->list(true);

$io->comment(sprintf('%d secret%s found in the vault.', \count($secrets), 1 !== \count($secrets) ? 's' : ''));

$skipped = 0;
if (!$input->getOption('force')) {
foreach ($this->localVault->list() as $k => $v) {
unset($secrets[$k]);
if (isset($secrets[$k])) {
++$skipped;
unset($secrets[$k]);
}
}
}

if ($skipped > 0) {
$io->warning([
sprintf('%d secret%s already overridden in the local vault and will be skipped.', $skipped, 1 !== $skipped ? 's are' : ' is'),
'Use the --force flag to override these.',
]);
}

foreach ($secrets as $k => $v) {
if (null === $v) {
$io->error($this->vault->getLastMessage());
Expand All @@ -83,6 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

$this->localVault->seal($k, $v);
$io->note($this->localVault->getLastMessage());
}

return 0;
Expand Down