This commit is contained in:
2023-04-16 02:32:36 +08:00
parent 4e390e89d6
commit 2273b3d1bd
+5 -3
View File
@@ -6,6 +6,7 @@ use Exception;
use Kiri\Server\CoroutineServer;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use ReflectionException;
use Swoole\Coroutine;
use Swoole\Http\Server as HServer;
use Swoole\Server;
@@ -111,18 +112,19 @@ trait TraitServer
}
return $array;
}
/**
* @param array $ports
* @return array<Config>
* @throws ReflectionException
*/
public function genConfigService(array $ports): array
{
$array = [];
$ports = $ports['ports'] ?? [];
foreach ($ports as $port) {
$config = \Kiri::getDi()->create(Config::class, [], $port);
$config = \Kiri::getDi()->make(Config::class, [], $port);
if ($port['type'] == Constant::SERVER_TYPE_WEBSOCKET) {
array_unshift($array, $config);
} else if ($port['type'] == Constant::SERVER_TYPE_HTTP) {