8000 feature #35285 [FrameworkBundle] Adding better output to secrets:decr… · symfony/symfony@f9949e3 · GitHub
[go: up one dir, main page]

Skip to content

Commit f9949e3

Browse files
committed
feature #35285 [FrameworkBundle] Adding better output to secrets:decrypt-to-local command (weaverryan)
This PR was merged into the 5.1-dev branch. Discussion ---------- [FrameworkBundle] Adding better output to secrets:decrypt-to-local command | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | none | License | MIT | Doc PR | not needed Hi! The `secrets:decrypt-to-local` doesn't give any output. This adds some basic details: <img width="1280" alt="Screen Shot 2020-01-09 at 11 53 54 AM" src="https://user-images.githubusercontent.com/121003/72087704-ebe0f480-32d6-11ea-950c-c698abde783d.png"> (note the `-vvv` wasn't necessary in the command to show the output). And the `<info>`part is fixed. Cheers! Commits ------- a6aa978 Adding better output to secrets:decrypt-to-local command
2 parents 9edb161 + a6aa978 commit f9949e3

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/Symfony/Bundle/FrameworkBundle/Command/SecretsDecryptToLocalCommand.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,25 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6969

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

72+
$io->comment(sprintf('%d secret%s found in the vault.', \count($secrets), 1 !== \count($secrets) ? 's' : ''));
73+
74+
$skipped = 0;
7275
if (!$input->getOption('force')) {
7376
foreach ($this->localVault->list() as $k => $v) {
74-
unset($secrets[$k]);
77+
if (isset($secrets[$k])) {
78+
++$skipped;
79+
unset($secrets[$k]);
80+
}
7581
}
7682
}
7783

84+
if ($skipped > 0) {
85+
$io->warning([
86+
sprintf('%d secret%s already overridden in the local vault and will be skipped.', $skipped, 1 !== $skipped ? 's are' : ' is'),
87+
'Use the --force flag to override these.',
88+
]);
89+
}
90+
7891
foreach ($secrets as $k => $v) {
7992
if (null === $v) {
8093
$io->error($this->vault->getLastMessage());
@@ -83,6 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
8396
}
8497

8598
$this->localVault->seal($k, $v);
99+
$io->note($this->localVault->getLastMessage());
86100
}
87101

88102
return 0;

0 commit comments

Comments
 (0)
0