Cast keys correctly in envUpdate

This commit is contained in:
abdulmohsen
2024-05-16 17:58:02 +03:00
parent 09827e3ebb
commit 8f8840a3db
2 changed files with 14 additions and 3 deletions

View File

@@ -60,7 +60,7 @@ return (function () {
[ [
'key' => 'WS_LIBRARY_SEGMENT', 'key' => 'WS_LIBRARY_SEGMENT',
'description' => 'How many items to request per a request to backends.', 'description' => 'How many items to request per a request to backends.',
'type' => 'string', 'type' => 'int',
], ],
[ [
'key' => 'WS_CACHE_URL', 'key' => 'WS_CACHE_URL',

View File

@@ -141,8 +141,19 @@ final class Env
]), HTTP_STATUS::HTTP_BAD_REQUEST); ]), HTTP_STATUS::HTTP_BAD_REQUEST);
} }
if ('bool' === ag($spec, 'type')) { switch (ag($spec, 'type', 'string')) {
settype($value, 'bool'); case 'bool':
settype($value, 'bool');
break;
case 'int':
settype($value, 'int');
break;
case 'float':
settype($value, 'float');
break;
default:
settype($value, 'string');
break;
} }
$this->envFile->set($key, $value)->persist(); $this->envFile->set($key, $value)->persist();