Added the ability to secure the webhook endpoint.

This commit is contained in:
Abdulmhsen B. A. A
2024-05-05 20:44:35 +03:00
parent 4f1c783903
commit 1dc1405bd7
7 changed files with 219 additions and 49 deletions

View File

@@ -17,11 +17,6 @@ final class Env
{
public const string URL = '%{api.prefix}/system/env';
private const array MASK = [
'WS_API_KEY',
'WS_CACHE_URL'
];
private EnvFile $envFile;
public function __construct()
@@ -32,6 +27,8 @@ final class Env
#[Get(self::URL . '[/]', name: 'system.env')]
public function envList(iRequest $request): iResponse
{
$spec = require __DIR__ . '/../../../config/env.spec.php';
$response = [
'data' => [],
'file' => Config::get('path') . '/config/.env',
@@ -45,7 +42,7 @@ final class Env
$response['data'][] = [
'key' => $key,
'value' => $val,
'mask' => in_array($key, self::MASK),
'mask' => (bool)ag($spec, "{$key}.mask", false),
];
}