2018-11-24 01:43:48 -06:00
|
|
|
<?php
|
2019-10-05 10:26:10 -05:00
|
|
|
|
2018-11-24 01:43:48 -06:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2022-01-20 13:16:37 -06:00
|
|
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
2021-08-07 04:05:20 -05:00
|
|
|
|
2023-01-12 12:26:36 -06:00
|
|
|
use function Shlinkio\Shlink\Config\getOpenswooleConfigFromEnv;
|
|
|
|
|
2021-10-23 09:32:06 -05:00
|
|
|
use const Shlinkio\Shlink\MIN_TASK_WORKERS;
|
2018-11-24 01:43:48 -06:00
|
|
|
|
2022-04-23 03:32:07 -05:00
|
|
|
return (static function (): array {
|
2022-04-23 05:44:17 -05:00
|
|
|
$taskWorkers = (int) EnvVars::TASK_WORKER_NUM->loadFromEnv(16);
|
2018-11-24 01:43:48 -06:00
|
|
|
|
2021-10-23 09:32:06 -05:00
|
|
|
return [
|
2019-07-14 03:46:31 -05:00
|
|
|
|
2021-10-23 09:32:06 -05: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 05:44:17 -05:00
|
|
|
'port' => (int) EnvVars::PORT->loadFromEnv(8080),
|
2021-10-23 09:32:06 -05:00
|
|
|
'process-name' => 'shlink',
|
|
|
|
|
|
|
|
'options' => [
|
2023-01-12 12:26:36 -06:00
|
|
|
...getOpenswooleConfigFromEnv(),
|
2022-04-23 05:44:17 -05:00
|
|
|
'worker_num' => (int) EnvVars::WEB_WORKER_NUM->loadFromEnv(16),
|
2021-12-19 03:23:55 -06:00
|
|
|
'task_worker_num' => max($taskWorkers, MIN_TASK_WORKERS),
|
2021-10-23 09:32:06 -05:00
|
|
|
],
|
2019-07-14 03:46:31 -05:00
|
|
|
],
|
2018-11-24 01:43:48 -06:00
|
|
|
],
|
|
|
|
|
2021-10-23 09:32:06 -05:00
|
|
|
];
|
|
|
|
})();
|