chore: remove retundant .env files. some additional fixes
This commit is contained in:
@@ -159,6 +159,27 @@ final readonly class ContainerBootstrapper
|
||||
return $request;
|
||||
});
|
||||
|
||||
// TEMPORARY FIX: Manual DatabasePlatform binding until Initializer Discovery issue is resolved
|
||||
$container->singleton(\App\Framework\Database\Platform\DatabasePlatform::class, function ($container) {
|
||||
error_log("ContainerBootstrapper: Creating DatabasePlatform singleton");
|
||||
|
||||
$env = $container->get(\App\Framework\Config\Environment::class);
|
||||
$driver = $env->get('DB_DRIVER', 'pgsql');
|
||||
|
||||
error_log("ContainerBootstrapper: DB_DRIVER = {$driver}");
|
||||
|
||||
$platform = match($driver) {
|
||||
'mysql', 'mysqli' => new \App\Framework\Database\Platform\MySQLPlatform(),
|
||||
'pgsql', 'postgres', 'postgresql' => new \App\Framework\Database\Platform\PostgreSQLPlatform(),
|
||||
'sqlite' => throw new \RuntimeException('SQLite platform not yet implemented'),
|
||||
default => throw new \RuntimeException("Unsupported database driver: {$driver}")
|
||||
};
|
||||
|
||||
error_log("ContainerBootstrapper: DatabasePlatform created: " . get_class($platform));
|
||||
|
||||
return $platform;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,21 +15,13 @@ final readonly class RateLimiterInitializer
|
||||
{
|
||||
public function __construct(
|
||||
private Container $container
|
||||
) {
|
||||
}
|
||||
|
||||
#[Initializer]
|
||||
public function createStorageInterface(): StorageInterface
|
||||
{
|
||||
$cache = $this->container->get(Cache::class);
|
||||
|
||||
return new CacheStorage($cache);
|
||||
}
|
||||
) {}
|
||||
|
||||
#[Initializer]
|
||||
public function createRateLimiter(): RateLimiter
|
||||
{
|
||||
$storage = $this->container->get(StorageInterface::class);
|
||||
$cache = $this->container->get(Cache::class);
|
||||
$storage = new CacheStorage($cache);
|
||||
|
||||
return new RateLimiter($storage);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,10 @@ namespace App\Framework\RateLimit\Storage;
|
||||
use App\Framework\Cache\Cache;
|
||||
use App\Framework\Cache\CacheKey;
|
||||
use App\Framework\Core\ValueObjects\Duration;
|
||||
use App\Framework\DI\Attributes\DefaultImplementation;
|
||||
use App\Framework\RateLimit\TokenBucket;
|
||||
|
||||
#[DefaultImplementation]
|
||||
final readonly class CacheStorage implements StorageInterface
|
||||
{
|
||||
public function __construct(
|
||||
|
||||
Reference in New Issue
Block a user