@@ -44,9 +44,20 @@ private function getUptimeApi()
4444 if (file_exists ($ configPath )) {
4545 // codacy:ignore - parse_ini_file() required for config parsing in standalone service
4646 $ config = parse_ini_file ($ configPath );
47- if ($ config && !empty ($ config ['api_key ' ])) {
48- $ this ->uptimeApi = new UptimeRobotAPI ($ config ['api_key ' ]);
47+
48+ // Debug logging
49+ error_log ("UptimeRobot config parse result: " . print_r ($ config , true ));
50+
51+ if ($ config && isset ($ config ['api_key ' ]) && !empty (trim ($ config ['api_key ' ]))) {
52+ error_log ("UptimeRobot API key found: " . substr (trim ($ config ['api_key ' ]), 0 , 10 ) . "... " );
53+ $ this ->uptimeApi = new UptimeRobotAPI (trim ($ config ['api_key ' ]));
54+ } else {
55+ error_log ("UptimeRobot API key validation failed - config: " . ($ config ? 'exists ' : 'false ' ) .
56+ ", isset: " . (isset ($ config ['api_key ' ]) ? 'yes ' : 'no ' ) .
57+ ", empty: " . (isset ($ config ['api_key ' ]) ? (empty (trim ($ config ['api_key ' ])) ? 'yes ' : 'no ' ) : 'n/a ' ));
4958 }
59+ } else {
60+ error_log ("UptimeRobot config file not found at: " . $ configPath );
5061 }
5162 }
5263 return $ this ->uptimeApi ;
@@ -75,6 +86,7 @@ public function getStatus()
7586 $ api = $ this ->getUptimeApi ();
7687
7788 if (!$ api ) {
89+ error_log ("UptimeController: API instance is null " );
7890 $ result = [
7991 'enabled ' => false ,
8092 'reason ' => 'UptimeRobot API not configured '
@@ -84,7 +96,9 @@ public function getStatus()
8496 return ;
8597 }
8698
99+ error_log ("UptimeController: About to call getMonitors() " );
87100 $ monitors = $ api ->getMonitors ();
101+ error_log ("UptimeController: getMonitors() returned: " . ($ monitors === false ? 'FALSE ' : (is_array ($ monitors ) ? count ($ monitors ) . ' monitors ' : 'unknown ' )));
88102
89103 if (!$ monitors ) {
90104 $ result = [
0 commit comments