From ffe10d4916b1c94bb9f5c5cd9028851df3dc1ed9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 8 May 2025 17:39:47 +0200 Subject: feat: allow setting system config values with json value Signed-off-by: Robin Appelman --- core/Command/Config/System/SetConfig.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'core/Command') diff --git a/core/Command/Config/System/SetConfig.php b/core/Command/Config/System/SetConfig.php index 4d23c191ac1..62ab7f7120f 100644 --- a/core/Command/Config/System/SetConfig.php +++ b/core/Command/Config/System/SetConfig.php @@ -142,6 +142,13 @@ class SetConfig extends Base { 'readable-value' => ($value === '') ? 'empty string' : 'string ' . $value, ]; + case 'json': + $value = json_decode($value, true); + return [ + 'value' => $value, + 'readable-value' => 'json ' . json_encode($value), + ]; + default: throw new \InvalidArgumentException('Invalid type'); } @@ -183,7 +190,7 @@ class SetConfig extends Base { */ public function completeOptionValues($optionName, CompletionContext $context) { if ($optionName === 'type') { - return ['string', 'integer', 'double', 'boolean']; + return ['string', 'integer', 'double', 'boolean', 'json', 'null']; } return parent::completeOptionValues($optionName, $context); } -- cgit v1.2.3