Adding non-rimo clusters to cluster list in adb import broker

This commit is contained in:
Frank Schubert
2025-07-16 12:16:40 +02:00
parent 202a7fd478
commit b33f4bc918

View File

@@ -9,7 +9,7 @@ posix_setrlimit(POSIX_RLIMIT_FSIZE, 1024*1024*1024*5, 1024*1024*1024*5); // Limi
if(pidislocked()) {
_debug_log("ADB Rimo Import Broker läuft bereits (pidfile vorhanden)");
die("ADB Rimo Import Broker läuft bereits (pidfile vorhanden)");
die("ADB Rimo Import Broker läuft bereits (pidfile vorhanden)\n");
}
if(!lockpid()) {
die("Error creating lock file!\n");
@@ -18,7 +18,7 @@ if(!lockpid()) {
require("../../config/config.php");
$debug_log = false;
$valid_adb_sources = ["rimo-rest-api", "citycom-oan-api"];
/*
* Redirecting output so rlimit for filesize works
*/
@@ -243,6 +243,7 @@ while(1) {
unlockpid();
function loadClusters() {
global $valid_adb_sources;
$clusters = [];
$netowners = ["estmk", "rml", "sbidi"];
@@ -293,10 +294,21 @@ function loadClusters() {
foreach ($clustersResponse->item as $cluster) {
$cluster_data = ["apiOwner" => $apiOwner, "apiKey" => $apiToken, "apiUrl" => $apiUrl, "cluster" => $cluster];
$clusters[] = $cluster_data;
$clusters[$cluster->id] = $cluster_data;
}
}
foreach(ADBNetzgebietModel::getAll() as $netzgebiet) {
if(!in_array($netzgebiet->source, $valid_adb_sources)) continue;
if(!array_key_exists($netzgebiet->source_id, $clusters)) {
$netzgebiet->id = $netzgebiet->source_id;
$clusters[$netzgebiet->source_id] = ["apiOwner" => $apiOwner, "apiKey" => $apiToken, "apiUrl" => $apiUrl, "cluster" => $netzgebiet];
}
}
return $clusters;
}