Enable Discovery debug logging for production troubleshooting

- Add DISCOVERY_LOG_LEVEL=debug
- Add DISCOVERY_SHOW_PROGRESS=true
- Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
2025-08-11 20:13:26 +02:00
parent 59fd3dd3b1
commit 55a330b223
3683 changed files with 2956207 additions and 16948 deletions

View File

@@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace App\Framework\Http;
/**
@@ -10,14 +12,100 @@ final readonly class IpAddress
public function __construct(
public string $value
) {
if (!filter_var($value, FILTER_VALIDATE_IP)) {
if (! filter_var($value, FILTER_VALIDATE_IP)) {
throw new \InvalidArgumentException("Invalid IP address: {$value}");
}
}
// Factory Methods
public static function from(string $ip): self
{
return new self($ip);
}
public static function fromRequest(): ?self
{
$headers = [
'HTTP_CF_CONNECTING_IP', // Cloudflare
'HTTP_CLIENT_IP', // Proxy
'HTTP_X_FORWARDED_FOR', // Load balancer/proxy
'HTTP_X_FORWARDED', // Proxy
'HTTP_X_CLUSTER_CLIENT_IP', // Cluster
'HTTP_FORWARDED_FOR', // Proxy
'HTTP_FORWARDED', // Proxy
'REMOTE_ADDR', // Standard
];
foreach ($headers as $header) {
if (! empty($_SERVER[$header])) {
$ip = trim(explode(',', $_SERVER[$header])[0]);
if (self::isValid($ip)) {
return new self($ip);
}
}
}
return null;
}
public static function localhost(): self
{
return new self('127.0.0.1');
}
// Validation
public static function isValid(string $ip): bool
{
return filter_var($ip, FILTER_VALIDATE_IP) !== false;
}
// Basic checks
public function isPrivate(): bool
{
return !filter_var($this->value, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE);
return ! filter_var($this->value, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE);
}
public function isPublic(): bool
{
return ! $this->isPrivate() && ! $this->isReserved();
}
public function isReserved(): bool
{
return filter_var($this->value, FILTER_VALIDATE_IP, FILTER_FLAG_NO_RES_RANGE) === false;
}
public function isLoopback(): bool
{
if ($this->isV4()) {
return str_starts_with($this->value, '127.');
}
return $this->value === '::1';
}
/**
* Check if IP is considered local (private or loopback)
*/
public function isLocal(): bool
{
return $this->isPrivate() || $this->isLoopback();
}
public function isV4(): bool
{
return filter_var($this->value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) !== false;
}
public function isV6(): bool
{
return filter_var($this->value, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6) !== false;
}
// Comparison
public function equals(IpAddress $other): bool
{
return $this->value === $other->value;
}
public function __toString(): string