Skip to content

Commit 2a0ec3b

Browse files
committed
feat: allow setting system config values with json value
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent 648745d commit 2a0ec3b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

core/Command/Config/System/SetConfig.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ protected function castValue($value, $type) {
142142
'readable-value' => ($value === '') ? 'empty string' : 'string ' . $value,
143143
];
144144

145+
case 'json':
146+
$value = json_decode($value, true);
147+
return [
148+
'value' => $value,
149+
'readable-value' => 'json ' . json_encode($value),
150+
];
151+
145152
default:
146153
throw new \InvalidArgumentException('Invalid type');
147154
}
@@ -183,7 +190,7 @@ protected function mergeArrayValue(array $configNames, $existingValues, $value,
183190
*/
184191
public function completeOptionValues($optionName, CompletionContext $context) {
185192
if ($optionName === 'type') {
186-
return ['string', 'integer', 'double', 'boolean'];
193+
return ['string', 'integer', 'double', 'boolean', 'json', 'null'];
187194
}
188195
return parent::completeOptionValues($optionName, $context);
189196
}

0 commit comments

Comments
 (0)