Merge pull request #52693 from nextcloud/config-system-set-json

feat: allow setting system config values with json value
pull/52774/head
Robin Appelman 5 months ago committed by GitHub
commit 7e9fc7604a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 9
      core/Command/Config/System/SetConfig.php

@ -142,6 +142,13 @@ class SetConfig extends Base {
'readable-value' => ($value === '') ? 'empty string' : 'string ' . $value, 'readable-value' => ($value === '') ? 'empty string' : 'string ' . $value,
]; ];
case 'json':
$value = json_decode($value, true);
return [
'value' => $value,
'readable-value' => 'json ' . json_encode($value),
];
default: default:
throw new \InvalidArgumentException('Invalid type'); throw new \InvalidArgumentException('Invalid type');
} }
@ -183,7 +190,7 @@ class SetConfig extends Base {
*/ */
public function completeOptionValues($optionName, CompletionContext $context) { public function completeOptionValues($optionName, CompletionContext $context) {
if ($optionName === 'type') { if ($optionName === 'type') {
return ['string', 'integer', 'double', 'boolean']; return ['string', 'integer', 'double', 'boolean', 'json', 'null'];
} }
return parent::completeOptionValues($optionName, $context); return parent::completeOptionValues($optionName, $context);
} }

Loading…
Cancel
Save