Fixed searching metadata/extra fields. Added system ENV.
This commit is contained in:
@@ -135,7 +135,7 @@ final class Index
|
||||
);
|
||||
}
|
||||
|
||||
if (preg_match('/[^a-zA-Z0-9_]/', $sField)) {
|
||||
if (preg_match('/[^a-zA-Z0-9_\.]/', $sField)) {
|
||||
return api_error(
|
||||
'Invalid value for key query string expected value format is [a-zA-Z0-9_].',
|
||||
HTTP_STATUS::HTTP_BAD_REQUEST
|
||||
@@ -166,7 +166,7 @@ final class Index
|
||||
);
|
||||
}
|
||||
|
||||
if (preg_match('/[^a-zA-Z0-9_]/', $sField)) {
|
||||
if (preg_match('/[^a-zA-Z0-9_\.]/', $sField)) {
|
||||
return api_error(
|
||||
'Invalid value for key query string expected value format is [a-zA-Z0-9_].',
|
||||
HTTP_STATUS::HTTP_BAD_REQUEST
|
||||
|
||||
36
src/API/System/Env.php
Normal file
36
src/API/System/Env.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\API\System;
|
||||
|
||||
use App\Libs\Attributes\Route\Get;
|
||||
use App\Libs\HTTP_STATUS;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
#[Get(self::URL . '[/]', name: 'system.env')]
|
||||
final class Env
|
||||
{
|
||||
public const URL = '%{api.prefix}/system/env';
|
||||
|
||||
public function __invoke(ServerRequestInterface $request, array $args = []): ResponseInterface
|
||||
{
|
||||
$response = [
|
||||
'@self' => (string)$request->getUri()->withHost('')->withPort(0)->withScheme(''),
|
||||
'data' => [],
|
||||
];
|
||||
|
||||
foreach (getenv() as $key => $val) {
|
||||
if (false === str_starts_with($key, 'WS_') && $key !== 'HTTP_PORT') {
|
||||
continue;
|
||||
}
|
||||
$response['data'][] = [
|
||||
'key' => $key,
|
||||
'value' => $val,
|
||||
];
|
||||
}
|
||||
|
||||
return api_response($response, HTTP_STATUS::HTTP_OK, []);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user