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.
This commit is contained in:
Jeroen De Meerleer 2024-06-03 13:51:05 +02:00
parent 1534574e97
commit d829ac06b0
No known key found for this signature in database
GPG Key ID: 3B23D1B3498D7641

View File

@ -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;