Skip to content

Commit 3ac7be8

Browse files
committed
Allowing empty secrets to be set
1 parent 0f6f948 commit 3ac7be8

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Command/SecretsSetCommand.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
9696
$value = strtr(substr(base64_encode(random_bytes($random)), 0, $random), '+/', '-_');
9797
} elseif (!$file = $input->getArgument('file')) {
9898
$value = $io->askHidden('Please type the secret value');
99+
100+
if (null === $value) {
101+
$io->warning('No value provided: using empty string');
102+
$value = '';
103+
}
99104
} elseif ('-' === $file) {
100105
$value = file_get_contents('php://stdin');
101106
} elseif (is_file($file) && is_readable($file)) {
@@ -106,12 +111,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
106111
throw new \InvalidArgumentException(sprintf('File is not readable: "%s".', $file));
107112
}
108113

109-
if (null === $value) {
110-
$io->warning('No value provided, aborting.');
111-
112-
return 1;
113-
}
114-
115114
if ($vault->generateKeys()) {
116115
$io->success($vault->getLastMessage());
117116

0 commit comments

Comments
 (0)