Compare commits
No commits in common. "f06c804c249c397f63bed9e6b88dca91cf0a8606" and "b52abb69c79d19d9a99b77aa4255b9e4dac83b4e" have entirely different histories.
f06c804c24
...
b52abb69c7
11
index.php
11
index.php
@ -1,17 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if($_SERVER["REQUEST_URI"] == '/metrics') {
|
|
||||||
header('Content-Type: text/plain; version=0.0.4');
|
header('Content-Type: text/plain; version=0.0.4');
|
||||||
$config = getenv('CONFIG_FILE');
|
$config = getenv('CONFIG_FILE');
|
||||||
$phpbin = getenv('PHP_BINARY');
|
$phpbin = getenv('PHP_BINARY');
|
||||||
$output = shell_exec('CONFIG_FILE="' . $config . '" ' . $phpbin . ' ' . $_SERVER['DOCUMENT_ROOT'] . 'script.php');
|
$output = shell_exec('CONFIG_FILE="' . $config . '" ' . $phpbin . ' ' . $_SERVER['DOCUMENT_ROOT'] . 'script.php');
|
||||||
echo $output;
|
echo $output;
|
||||||
} else {
|
|
||||||
require_once('vendor/autoload.php');
|
|
||||||
http_response_code(404);
|
|
||||||
$loader = new \Twig\Loader\FilesystemLoader('templates');
|
|
||||||
$twig = new \Twig\Environment($loader, [
|
|
||||||
'cache' => 'twig_cache',
|
|
||||||
]);
|
|
||||||
echo $twig->render('404.twig', ['path' => $_SERVER["REQUEST_URI"]]);
|
|
||||||
}
|
|
@ -14,6 +14,8 @@ if(file_exists($cacheFile)) {
|
|||||||
} else {
|
} else {
|
||||||
$oldconfig = [];
|
$oldconfig = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(php_sapi_name() == 'cli' || $_SERVER["REQUEST_URI"] == '/metrics') {
|
||||||
foreach ($config as $key => &$metric) {
|
foreach ($config as $key => &$metric) {
|
||||||
if (!isset($metric['submetrics'])) {
|
if (!isset($metric['submetrics'])) {
|
||||||
$metric['submetrics'] = [$metric];
|
$metric['submetrics'] = [$metric];
|
||||||
@ -123,6 +125,7 @@ $twig = new \Twig\Environment($loader, [
|
|||||||
'cache' => 'twig_cache',
|
'cache' => 'twig_cache',
|
||||||
]);
|
]);
|
||||||
echo $twig->render('metrics.twig', ['config' => $config]);
|
echo $twig->render('metrics.twig', ['config' => $config]);
|
||||||
|
}
|
||||||
|
|
||||||
function getArrayValue($elem, $array) {
|
function getArrayValue($elem, $array) {
|
||||||
$elem = explode('.', $elem);
|
$elem = explode('.', $elem);
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<title>Page Title</title>
|
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
||||||
<style>
|
|
||||||
</style>
|
|
||||||
<body>
|
|
||||||
<h1>404 Uri {{ path }} not found</h1>
|
|
||||||
<p><a href="/metrics">/metrics</a></p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue
Block a user