refactor(deployment): Remove WireGuard VPN dependency and restore public service access
Remove WireGuard integration from production deployment to simplify infrastructure: - Remove docker-compose-direct-access.yml (VPN-bound services) - Remove VPN-only middlewares from Grafana, Prometheus, Portainer - Remove WireGuard middleware definitions from Traefik - Remove WireGuard IPs (10.8.0.0/24) from Traefik forwarded headers All monitoring services now publicly accessible via subdomains: - grafana.michaelschiemer.de (with Grafana native auth) - prometheus.michaelschiemer.de (with Basic Auth) - portainer.michaelschiemer.de (with Portainer native auth) All services use Let's Encrypt SSL certificates via Traefik.
This commit is contained in:
149
tests/debug/generate-test-qrcodes.php
Normal file
149
tests/debug/generate-test-qrcodes.php
Normal file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
use App\Framework\QrCode\QrCodeGenerator;
|
||||
use App\Framework\QrCode\QrCodeRenderer;
|
||||
use App\Framework\QrCode\ValueObjects\ErrorCorrectionLevel;
|
||||
use App\Framework\QrCode\ValueObjects\QrCodeConfig;
|
||||
use App\Framework\QrCode\ValueObjects\QrCodeVersion;
|
||||
use App\Framework\QrCode\ValueObjects\EncodingMode;
|
||||
|
||||
echo "=== Generating Test QR Codes ===\n\n";
|
||||
|
||||
// Create output directory
|
||||
$outputDir = __DIR__ . '/test-qrcodes';
|
||||
if (!is_dir($outputDir)) {
|
||||
mkdir($outputDir, 0755, true);
|
||||
echo "Created output directory: {$outputDir}\n\n";
|
||||
} else {
|
||||
echo "Output directory: {$outputDir}\n\n";
|
||||
}
|
||||
|
||||
// Test cases with different data types and configurations
|
||||
$testCases = [
|
||||
[
|
||||
'data' => 'HELLO WORLD',
|
||||
'version' => 1,
|
||||
'level' => ErrorCorrectionLevel::M,
|
||||
'mode' => EncodingMode::BYTE,
|
||||
'filename' => 'hello-world-v1-m.svg',
|
||||
'description' => 'Standard text, Version 1, Level M'
|
||||
],
|
||||
[
|
||||
'data' => 'A',
|
||||
'version' => 1,
|
||||
'level' => ErrorCorrectionLevel::M,
|
||||
'mode' => EncodingMode::BYTE,
|
||||
'filename' => 'single-char-v1-m.svg',
|
||||
'description' => 'Single character, Version 1, Level M'
|
||||
],
|
||||
[
|
||||
'data' => 'HELLO',
|
||||
'version' => 1,
|
||||
'level' => ErrorCorrectionLevel::M,
|
||||
'mode' => EncodingMode::BYTE,
|
||||
'filename' => 'hello-v1-m.svg',
|
||||
'description' => 'Short text, Version 1, Level M'
|
||||
],
|
||||
[
|
||||
'data' => 'https://example.com',
|
||||
'version' => 1,
|
||||
'level' => ErrorCorrectionLevel::M,
|
||||
'mode' => EncodingMode::BYTE,
|
||||
'filename' => 'url-v1-m.svg',
|
||||
'description' => 'URL, Version 1, Level M'
|
||||
],
|
||||
[
|
||||
'data' => 'Test QR Code',
|
||||
'version' => 1,
|
||||
'level' => ErrorCorrectionLevel::M,
|
||||
'mode' => EncodingMode::BYTE,
|
||||
'filename' => 'test-text-v1-m.svg',
|
||||
'description' => 'Text, Version 1, Level M'
|
||||
],
|
||||
[
|
||||
'data' => '123456789012345678901234567890',
|
||||
'version' => 2,
|
||||
'level' => ErrorCorrectionLevel::M,
|
||||
'mode' => EncodingMode::BYTE,
|
||||
'filename' => 'long-text-v2-m.svg',
|
||||
'description' => 'Long text, Version 2, Level M'
|
||||
],
|
||||
[
|
||||
'data' => 'QR Code Test',
|
||||
'version' => 1,
|
||||
'level' => ErrorCorrectionLevel::M,
|
||||
'mode' => EncodingMode::BYTE,
|
||||
'filename' => 'qr-test-v1-m.svg',
|
||||
'description' => 'Short test text, Version 1, Level M'
|
||||
],
|
||||
[
|
||||
'data' => '12345',
|
||||
'version' => 1,
|
||||
'level' => ErrorCorrectionLevel::M,
|
||||
'mode' => EncodingMode::BYTE,
|
||||
'filename' => 'numbers-v1-m.svg',
|
||||
'description' => 'Numbers, Version 1, Level M'
|
||||
],
|
||||
[
|
||||
'data' => 'Hello!',
|
||||
'version' => 1,
|
||||
'level' => ErrorCorrectionLevel::M,
|
||||
'mode' => EncodingMode::BYTE,
|
||||
'filename' => 'hello-exclamation-v1-m.svg',
|
||||
'description' => 'Text with special char, Version 1, Level M'
|
||||
],
|
||||
[
|
||||
'data' => 'test@example.com',
|
||||
'version' => 1,
|
||||
'level' => ErrorCorrectionLevel::M,
|
||||
'mode' => EncodingMode::BYTE,
|
||||
'filename' => 'email-v1-m.svg',
|
||||
'description' => 'Email address, Version 1, Level M'
|
||||
],
|
||||
];
|
||||
|
||||
$renderer = new QrCodeRenderer();
|
||||
$successCount = 0;
|
||||
$errorCount = 0;
|
||||
|
||||
foreach ($testCases as $testCase) {
|
||||
echo "Generating: {$testCase['description']}\n";
|
||||
echo " Data: '{$testCase['data']}'\n";
|
||||
echo " Version: {$testCase['version']}, Level: {$testCase['level']->value}\n";
|
||||
|
||||
try {
|
||||
$config = new QrCodeConfig(
|
||||
version: QrCodeVersion::fromNumber($testCase['version']),
|
||||
errorCorrectionLevel: $testCase['level'],
|
||||
encodingMode: $testCase['mode']
|
||||
);
|
||||
|
||||
$matrix = QrCodeGenerator::generate($testCase['data'], $config);
|
||||
$svg = $renderer->renderSvg($matrix);
|
||||
|
||||
$filepath = $outputDir . '/' . $testCase['filename'];
|
||||
file_put_contents($filepath, $svg);
|
||||
|
||||
$fileSize = filesize($filepath);
|
||||
echo " ✅ Saved: {$testCase['filename']} ({$fileSize} bytes)\n";
|
||||
$successCount++;
|
||||
} catch (\Exception $e) {
|
||||
echo " ❌ Error: " . $e->getMessage() . "\n";
|
||||
$errorCount++;
|
||||
}
|
||||
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
echo "=== Summary ===\n";
|
||||
echo "Successfully generated: {$successCount} QR codes\n";
|
||||
if ($errorCount > 0) {
|
||||
echo "Errors: {$errorCount}\n";
|
||||
}
|
||||
echo "Output directory: {$outputDir}\n";
|
||||
echo "\nAll QR codes saved as SVG files. You can open them in a browser or scan them with a mobile phone.\n";
|
||||
|
||||
Reference in New Issue
Block a user