Skip to content

Commit

Permalink
fix(appconfig): returns correct value on details
Browse files Browse the repository at this point in the history
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
  • Loading branch information
ArtificialOwl committed Apr 17, 2024
1 parent b4004a2 commit eb19881
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/Command/Config/App/SetConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
*/
$sensitive = $input->getOption('sensitive');
try {
$currSensitive = $this->appConfig->isLazy($appName, $configName);
if ($sensitive === null || $sensitive === $currSensitive || !$this->ask($input, $output, ($sensitive) ? 'LAZY' : 'NOT LAZY')) {
$currSensitive = $this->appConfig->isSensitive($appName, $configName, null);
if ($sensitive === null || $sensitive === $currSensitive || !$this->ask($input, $output, ($sensitive) ? 'SENSITIVE' : 'NOT SENSITIVE')) {
$sensitive = $currSensitive;
}
} catch (AppConfigUnknownKeyException) {
Expand Down
10 changes: 8 additions & 2 deletions lib/private/AppConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -1034,14 +1034,20 @@ public function getDetails(string $app, string $key): array {
throw new AppConfigUnknownKeyException('unknown config key');
}

$value = $cache[$app][$key];
$sensitive = $this->isSensitive($app, $key, null);
if ($sensitive && str_starts_with($value, self::ENCRYPTION_PREFIX)) {
$value = $this->crypto->decrypt(substr($value, self::ENCRYPTION_PREFIX_LENGTH));
}

return [
'app' => $app,
'key' => $key,
'value' => $cache[$app][$key],
'value' => $value,
'type' => $type,
'lazy' => $lazy,
'typeString' => $typeString,
'sensitive' => $this->isSensitive($app, $key, null)
'sensitive' => $sensitive
];
}

Expand Down

0 comments on commit eb19881

Please sign in to comment.