chore: complete update
This commit is contained in:
@@ -1 +1,40 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
// Debug-Modus (aktiviert ausführliche Fehlerbehandlung)
|
||||
'debug' => true,
|
||||
|
||||
// Discovery-Konfiguration
|
||||
'async_discovery' => true,
|
||||
|
||||
// Standard-Middleware-Stack
|
||||
'middleware' => [
|
||||
// Globale Middleware für alle Requests
|
||||
'global' => [
|
||||
\App\Framework\Http\Middlewares\ControllerRequestMiddleware::class,
|
||||
\App\Framework\Validation\ValidationErrorMiddleware::class,
|
||||
\App\Framework\Http\Middlewares\RoutingMiddleware::class
|
||||
],
|
||||
|
||||
// Gruppen-spezifische Middleware
|
||||
'api' => [
|
||||
// Hier können Sie API-spezifische Middleware hinzufügen
|
||||
],
|
||||
|
||||
'web' => [
|
||||
// Hier können Sie Web-spezifische Middleware hinzufügen
|
||||
]
|
||||
],
|
||||
|
||||
// Cache-Einstellungen
|
||||
'cache' => [
|
||||
'enabled' => true,
|
||||
'ttl' => 3600, // Zeit in Sekunden
|
||||
],
|
||||
|
||||
// Logging-Einstellungen
|
||||
'logging' => [
|
||||
'level' => 'debug', // Optionen: debug, info, notice, warning, error, critical, alert, emergency
|
||||
'path' => 'logs/app.log',
|
||||
],
|
||||
];
|
||||
|
||||
11
config/middleware.php
Normal file
11
config/middleware.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use App\Framework\Http\Middleware\ServeStaticFilesMiddleware;
|
||||
|
||||
return [
|
||||
// Middleware wird in dieser Reihenfolge ausgeführt
|
||||
'global' => [
|
||||
ServeStaticFilesMiddleware::class,
|
||||
// Weitere globale Middleware hier hinzufügen
|
||||
]
|
||||
];
|
||||
62
config/services.php
Normal file
62
config/services.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Config;
|
||||
|
||||
use App\Framework\DI\DefaultContainer;
|
||||
use App\Framework\Http\Middlewares\RateLimitingMiddleware;
|
||||
use App\Framework\Http\RateLimiter\RateLimiterConfig;
|
||||
use App\Framework\Http\RateLimiter\RedisRateLimiter;
|
||||
use Predis\Client as RedisClient;
|
||||
|
||||
/**
|
||||
* Konfiguriert die Dienste im DI-Container.
|
||||
*/
|
||||
return static function (DefaultContainer $container): void {
|
||||
// Registrierung von Redis, wenn noch nicht vorhanden
|
||||
if (!$container->has(RedisClient::class)) {
|
||||
$container->bind(RedisClient::class, function () {
|
||||
return new RedisClient([
|
||||
'scheme' => $_ENV['REDIS_SCHEME'] ?? 'tcp',
|
||||
'host' => $_ENV['REDIS_HOST'] ?? 'redis',
|
||||
'port' => (int)($_ENV['REDIS_PORT'] ?? 6379),
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
// Rate Limiter Konfiguration
|
||||
$container->bind(RateLimiterConfig::class, function () {
|
||||
$config = new RateLimiterConfig(
|
||||
defaultLimit: (int)($_ENV['RATE_LIMIT_DEFAULT'] ?? 60),
|
||||
windowSeconds: (int)($_ENV['RATE_LIMIT_WINDOW'] ?? 60)
|
||||
);
|
||||
|
||||
// Strengere Limits für sensible Bereiche
|
||||
return $config
|
||||
->withAuthLimit((int)($_ENV['RATE_LIMIT_AUTH'] ?? 10), (int)($_ENV['RATE_LIMIT_AUTH_WINDOW'] ?? 300))
|
||||
->withApiLimit((int)($_ENV['RATE_LIMIT_API'] ?? 30), (int)($_ENV['RATE_LIMIT_API_WINDOW'] ?? 60))
|
||||
// Weitere Limits hier hinzufügen...
|
||||
;
|
||||
});
|
||||
|
||||
// Rate Limiter Service
|
||||
$container->bind(RedisRateLimiter::class, function ($container) {
|
||||
return new RedisRateLimiter(
|
||||
$container->get(RedisClient::class)
|
||||
);
|
||||
});
|
||||
|
||||
// Rate Limiting Middleware
|
||||
$container->bind(RateLimitingMiddleware::class, function ($container) {
|
||||
$config = $container->get(RateLimiterConfig::class);
|
||||
return new RateLimitingMiddleware(
|
||||
$container->get(RedisClient::class),
|
||||
$config->getDefaultLimit(),
|
||||
$config->getWindowSeconds(),
|
||||
$config->getPathLimits()
|
||||
);
|
||||
});
|
||||
|
||||
// Weitere Dienste hier registrieren...
|
||||
};
|
||||
10
config/static-routes.json
Normal file
10
config/static-routes.json
Normal file
@@ -0,0 +1,10 @@
|
||||
[
|
||||
"/",
|
||||
"/about",
|
||||
"/contact",
|
||||
"/blog",
|
||||
"/products",
|
||||
"/services",
|
||||
"/imprint",
|
||||
"/privacy"
|
||||
]
|
||||
Reference in New Issue
Block a user