Add sanitized provisioning diagnostics
This commit is contained in:
@@ -198,7 +198,10 @@ function pnpaas_portainer_request(string $path, string $method = 'GET', ?array $
|
||||
throw new RuntimeException('Portainer ist nicht erreichbar.');
|
||||
}
|
||||
if ($status < 200 || ($status >= 300 && $status !== 304)) {
|
||||
throw new RuntimeException('Portainer hat die Anfrage abgelehnt.');
|
||||
$detail = trim(preg_replace('/\s+/', ' ', (string)$body) ?? '');
|
||||
$detail = preg_replace('/("?(?:token|password|api[_-]?key|secret)"?\s*:\s*)"[^"]*"/i', '$1"[redacted]"', $detail) ?? $detail;
|
||||
$detail = substr($detail, 0, 600);
|
||||
throw new RuntimeException('Portainer HTTP ' . $status . ($detail !== '' ? ': ' . $detail : '.'));
|
||||
}
|
||||
if ($body === '' || $body === null) {
|
||||
return [];
|
||||
|
||||
Reference in New Issue
Block a user