2018-11-24 10:43:48 +03:00
|
|
|
<?php
|
2019-10-05 18:26:10 +03:00
|
|
|
|
2018-11-24 10:43:48 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2022-01-20 22:16:37 +03:00
|
|
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
2021-08-07 12:05:20 +03:00
|
|
|
|
2023-01-12 21:26:36 +03:00
|
|
|
use function Shlinkio\Shlink\Config\getOpenswooleConfigFromEnv;
|
|
|
|
|
2021-10-23 17:32:06 +03:00
|
|
|
use const Shlinkio\Shlink\MIN_TASK_WORKERS;
|
2018-11-24 10:43:48 +03:00
|
|
|
|
2022-04-23 11:32:07 +03:00
|
|
|
return (static function (): array {
|
2022-04-23 13:44:17 +03:00
|
|
|
$taskWorkers = (int) EnvVars::TASK_WORKER_NUM->loadFromEnv(16);
|
2018-11-24 10:43:48 +03:00
|
|
|
|
2021-10-23 17:32:06 +03:00
|
|
|
return [
|
2019-07-14 11:46:31 +03:00
|
|
|
|
2021-10-23 17:32:06 +03:00
|
|
|
'mezzio-swoole' => [
|
|
|
|
// Setting this to true can have unexpected behaviors when running several concurrent slow DB queries
|
|
|
|
'enable_coroutine' => false,
|
|
|
|
|
|
|
|
'swoole-http-server' => [
|
|
|
|
'host' => '0.0.0.0',
|
2022-04-23 13:44:17 +03:00
|
|
|
'port' => (int) EnvVars::PORT->loadFromEnv(8080),
|
2021-10-23 17:32:06 +03:00
|
|
|
'process-name' => 'shlink',
|
|
|
|
|
|
|
|
'options' => [
|
2023-01-12 21:26:36 +03:00
|
|
|
...getOpenswooleConfigFromEnv(),
|
2022-04-23 13:44:17 +03:00
|
|
|
'worker_num' => (int) EnvVars::WEB_WORKER_NUM->loadFromEnv(16),
|
2021-12-19 12:23:55 +03:00
|
|
|
'task_worker_num' => max($taskWorkers, MIN_TASK_WORKERS),
|
2021-10-23 17:32:06 +03:00
|
|
|
],
|
2019-07-14 11:46:31 +03:00
|
|
|
],
|
2018-11-24 10:43:48 +03:00
|
|
|
],
|
|
|
|
|
2021-10-23 17:32:06 +03:00
|
|
|
];
|
|
|
|
})();
|