diff --git a/config/env.spec.php b/config/env.spec.php index 0a59816e..7169da1e 100644 --- a/config/env.spec.php +++ b/config/env.spec.php @@ -60,7 +60,7 @@ return (function () { [ 'key' => 'WS_LIBRARY_SEGMENT', 'description' => 'How many items to request per a request to backends.', - 'type' => 'string', + 'type' => 'int', ], [ 'key' => 'WS_CACHE_URL', diff --git a/src/API/System/Env.php b/src/API/System/Env.php index 54a9fe16..7a228245 100644 --- a/src/API/System/Env.php +++ b/src/API/System/Env.php @@ -141,8 +141,19 @@ final class Env ]), HTTP_STATUS::HTTP_BAD_REQUEST); } - if ('bool' === ag($spec, 'type')) { - settype($value, 'bool'); + switch (ag($spec, 'type', 'string')) { + 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();