Add support to load openswoole-specific config via env vars

This commit is contained in:
Alejandro Celaya 2023-01-12 19:26:36 +01:00
parent d75be372cb
commit 21863e8de6
6 changed files with 9 additions and 4 deletions

View File

@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
The status 308 is equivalent to 301, and 307 is equivalent to 302. The difference is that the spec requires the client to respect the original HTTP method when performing the redirect. With 301 and 302, some old clients might perform a `GET` request during the redirect, regardless the original request method.
* [#1662](https://github.com/shlinkio/shlink/issues/1662) Added support to provide openswoole-specific config options via env vars prefixed with `OPENSWOOLE_`.
### Changed
* *Nothing*

View File

@ -46,7 +46,7 @@
"pugx/shortid-php": "^1.1",
"ramsey/uuid": "^4.5",
"shlinkio/shlink-common": "^5.2",
"shlinkio/shlink-config": "^2.3",
"shlinkio/shlink-config": "dev-main#2a5b5c2 as 2.4",
"shlinkio/shlink-event-dispatcher": "^2.6",
"shlinkio/shlink-importer": "^5.0",
"shlinkio/shlink-installer": "dev-develop#5fcee9b as 8.3",

View File

@ -4,6 +4,8 @@ declare(strict_types=1);
use Shlinkio\Shlink\Core\Config\EnvVars;
use function Shlinkio\Shlink\Config\getOpenswooleConfigFromEnv;
use const Shlinkio\Shlink\MIN_TASK_WORKERS;
return (static function (): array {
@ -21,6 +23,7 @@ return (static function (): array {
'process-name' => 'shlink',
'options' => [
...getOpenswooleConfigFromEnv(),
'worker_num' => (int) EnvVars::WEB_WORKER_NUM->loadFromEnv(16),
'task_worker_num' => max($taskWorkers, MIN_TASK_WORKERS),
],

View File

@ -135,7 +135,7 @@ class NotFoundRedirectResolverTest extends TestCase
RouteResult::class,
RouteResult::fromRoute(
new Route(
'',
'foo',
$this->createMock(MiddlewareInterface::class),
['GET'],
$routeName,

View File

@ -55,7 +55,7 @@ class NotFoundTemplateHandlerTest extends TestCase
RouteResult::class,
RouteResult::fromRoute(
new Route(
'',
'foo',
$this->createMock(MiddlewareInterface::class),
['GET'],
RedirectAction::class,

View File

@ -95,7 +95,7 @@ class AuthenticationMiddlewareTest extends TestCase
{
$baseRequest = fn (string $routeName) => ServerRequestFactory::fromGlobals()->withAttribute(
RouteResult::class,
RouteResult::fromRoute(new Route($routeName, $this->getDummyMiddleware()), []),
RouteResult::fromRoute(new Route($routeName, $this->getDummyMiddleware())), // @phpstan-ignore-line
);
$apiKeyMessage = 'Expected one of the following authentication headers, ["X-Api-Key"], but none were provided';
$queryMessage = 'Expected authentication to be provided in "apiKey" query param';