Added /config endpoint and link in 404 page

The update includes the addition of a new '/config' endpoint in index.php, which returns the application's configuration as a JSON response. A corresponding link to this new endpoint has also been added to the 404 error page.
This commit is contained in:
Jeroen De Meerleer 2024-06-13 17:43:32 +02:00
parent f75be1fcaf
commit 8af61f97b0
Signed by: JeroenED
GPG Key ID: 28CCCB8F62BFADD6
2 changed files with 5 additions and 0 deletions

View File

@ -6,6 +6,10 @@ if($_SERVER["REQUEST_URI"] == '/metrics') {
$phpbin = getenv('PHP_BINARY');
$output = shell_exec('CONFIG_FILE="' . $config . '" ' . $phpbin . ' ' . $_SERVER['DOCUMENT_ROOT'] . 'script.php');
echo $output;
} elseif ($_SERVER["REQUEST_URI"] == '/config') {
header('Content-Type: application/json');
require_once getenv('CONFIG_FILE');
echo json_encode($config);
} elseif ($_SERVER["REQUEST_URI"] == '/version') {
header('Content-Type: application/json');
$git = [

View File

@ -8,6 +8,7 @@
<body>
<h1>404 Uri {{ path }} not found</h1>
<p><a href="/metrics">/metrics</a></p>
<p><a href="/config">/config</a></p>
<p><a href="/version">/version</a></p>
</body>
</html>