Allowing empty secrets to be set
This commit is contained in:
parent
0506f8ce2b
commit
c9bf0c8683
@ -96,6 +96,11 @@ EOF
|
|||||||
$value = strtr(substr(base64_encode(random_bytes($random)), 0, $random), '+/', '-_');
|
$value = strtr(substr(base64_encode(random_bytes($random)), 0, $random), '+/', '-_');
|
||||||
} elseif (!$file = $input->getArgument('file')) {
|
} elseif (!$file = $input->getArgument('file')) {
|
||||||
$value = $io->askHidden('Please type the secret value');
|
$value = $io->askHidden('Please type the secret value');
|
||||||
|
|
||||||
|
if (null === $value) {
|
||||||
|
$io->warning('No value provided: using empty string');
|
||||||
|
$value = '';
|
||||||
|
}
|
||||||
} elseif ('-' === $file) {
|
} elseif ('-' === $file) {
|
||||||
$value = file_get_contents('php://stdin');
|
$value = file_get_contents('php://stdin');
|
||||||
} elseif (is_file($file) && is_readable($file)) {
|
} elseif (is_file($file) && is_readable($file)) {
|
||||||
@ -106,12 +111,6 @@ EOF
|
|||||||
throw new \InvalidArgumentException(sprintf('File is not readable: "%s".', $file));
|
throw new \InvalidArgumentException(sprintf('File is not readable: "%s".', $file));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $value) {
|
|
||||||
$io->warning('No value provided, aborting.');
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($vault->generateKeys()) {
|
if ($vault->generateKeys()) {
|
||||||
$io->success($vault->getLastMessage());
|
$io->success($vault->getLastMessage());
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user