fix(appconfig): returns correct value on detailspull/44915/head
@@ -173,8 +173,8 @@ class SetConfig extends Base { | |||
*/ | |||
$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) { |
@@ -1034,14 +1034,20 @@ class AppConfig implements IAppConfig { | |||
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 | |||
]; | |||
} | |||
@@ -1253,7 +1253,7 @@ class AppConfigTest extends TestCase { | |||
[ | |||
'app' => 'sensitive-app', | |||
'key' => 'lazy-key', | |||
'value' => $this->baseStruct['sensitive-app']['lazy-key']['encrypted'], | |||
'value' => 'value', | |||
'type' => 4, | |||
'lazy' => true, | |||
'typeString' => 'string', |