2022-09-11 11:45:03 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Shlinkio\Shlink\Rest;
|
|
|
|
|
|
|
|
use Mezzio\Application;
|
|
|
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
|
|
|
|
|
|
|
use const PHP_SAPI;
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
2022-09-11 13:10:21 +03:00
|
|
|
// We will try to load the initial API key only for openswoole and RoadRunner.
|
|
|
|
// For php-fpm, the check against the database would happen on every request, resulting in a very bad performance.
|
2022-09-11 11:45:03 +03:00
|
|
|
'initial_api_key' => PHP_SAPI !== 'cli' ? null : EnvVars::INITIAL_API_KEY->loadFromEnv(),
|
|
|
|
|
|
|
|
'dependencies' => [
|
|
|
|
'delegators' => [
|
|
|
|
Application::class => [
|
|
|
|
ApiKey\InitialApiKeyDelegator::class,
|
|
|
|
],
|
|
|
|
],
|
|
|
|
],
|
|
|
|
|
|
|
|
];
|