From d829ac06b0403ed1e2b85b36ceedaa98f6423645 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Mon, 3 Jun 2024 13:51:05 +0200 Subject: [PATCH] Update URI check to include CLI request detection. The code now checks if the request URI is '/metrics' or if the PHP script is running from the command line interface (CLI). This change allows for proper handling of CLI requests in addition to web requests. --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index bf4249e..d127095 100644 --- a/index.php +++ b/index.php @@ -2,7 +2,7 @@ require 'vendor/autoload.php'; require 'config.php'; -if($_SERVER["REQUEST_URI"] == '/metrics') { +if($_SERVER["REQUEST_URI"] == '/metrics' || php_sapi_name() == 'cli') { foreach ($config as $key => &$c) { if(isset($c['command'])) { $output=null;