This commit is contained in:
xl
2023-05-25 16:59:17 +08:00
parent 4efac235a0
commit 76cb95a184
6 changed files with 10 additions and 15 deletions
+3 -4
View File
@@ -4,7 +4,6 @@ namespace Kiri\Server\Abstracts;
use Exception;
use Kiri;
use Kiri\Abstracts\Config;
use Kiri\Abstracts\Logger;
use Kiri\Exception\ConfigException;
use Kiri\Exception\NotFindClassException;
@@ -76,7 +75,7 @@ class AsyncServer implements ServerInterface
*/
private function initRpcListen(): void
{
$rpcService = Config::get('rpc', []);
$rpcService = \config('rpc', []);
if (!empty($rpcService)) {
$this->addListener(instance(SConfig::class, [], $rpcService));
}
@@ -123,7 +122,7 @@ class AsyncServer implements ServerInterface
throw new NotFindClassException('Unknown server type ' . $config->type);
}
$this->initServer($match, $config, $daemon);
$this->onEventListen($this->server, Config::get('server.events', []));
$this->onEventListen($this->server, \config('server.events', []));
$this->onEventListen($this->server, $config->events);
$this->onTaskListen();
}
@@ -175,7 +174,7 @@ class AsyncServer implements ServerInterface
*/
protected function systemConfig(SConfig $config, int $daemon): array
{
$settings = array_merge(Config::get('server.settings', []), $config->settings);
$settings = array_merge(\config('server.settings', []), $config->settings);
$settings[Constant::OPTION_DAEMONIZE] = (bool)$daemon;
$settings[Constant::OPTION_ENABLE_REUSE_PORT] = true;
$settings[Constant::OPTION_PID_FILE] = storage('.swoole.pid');
+1 -2
View File
@@ -5,7 +5,6 @@ namespace Kiri\Server\Abstracts;
use Closure;
use Exception;
use Kiri;
use Kiri\Abstracts\Config;
use Kiri\Abstracts\Component;
use Kiri\Server\Contract\OnProcessInterface;
use Psr\Container\ContainerExceptionInterface;
@@ -186,7 +185,7 @@ class ProcessManager extends Component
public function extracted(mixed $custom, Process $process): void
{
set_env('environmental', Kiri::PROCESS);
$system = sprintf('[%s].Custom Process', Config::get('id', 'system-service'));
$system = sprintf('[%s].Custom Process', \config('id', 'system-service'));
Kiri::getLogger()->alert($system . ' ' . $custom->getName() . ' start.');
if (Kiri::getPlatform()->isLinux()) {
$process->name($system . '[' . $process->pid . '].' . $custom->getName());
+1 -1
View File
@@ -64,7 +64,7 @@ trait TraitServer
*/
public function onSignal(): void
{
$signal = \Kiri\Abstracts\Config::get('signal', []);
$signal = \Kiri\Abstracts\\config('signal', []);
$this->onPcntlSignal(SIGINT, [$this, 'onSigint']);
foreach ($signal as $sig => $value) {
if (is_array($value) && is_string($value[0])) {