add CORS manager with relative docs
This commit is contained in:
@@ -7,6 +7,7 @@ require_once __DIR__ . '/vendor/autoload.php';
|
||||
use Api\Core\Container;
|
||||
use Api\Core\Config;
|
||||
use Api\Core\HttpClient;
|
||||
use Api\Core\CorsManager;
|
||||
use Api\Core\RateLimiter\RateLimiterInterface;
|
||||
use Api\Core\RateLimiter\FileRateLimiter;
|
||||
use Api\Core\RateLimiter\InMemoryRateLimiter;
|
||||
@@ -25,6 +26,13 @@ $container->singleton(HttpClient::class, function() {
|
||||
return new HttpClient();
|
||||
});
|
||||
|
||||
// CORS manager binding
|
||||
$container->singleton(CorsManager::class, function($c) {
|
||||
$config = $c->make(Config::class);
|
||||
$corsConfig = $config->get('cors', []);
|
||||
return new CorsManager($corsConfig);
|
||||
});
|
||||
|
||||
// Rate limiter driver configurabile via config or env: 'file' or 'memory'
|
||||
$rlDriver = $config->get('rate_limiter_driver', 'file');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user