qqq
This commit is contained in:
@@ -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');
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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])) {
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace Kiri\Server\Handler;
|
||||
|
||||
use Exception;
|
||||
use Kiri;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Core\Help;
|
||||
use Kiri\Events\EventDispatch;
|
||||
use Kiri\Server\Events\OnAfterWorkerStart;
|
||||
@@ -108,7 +107,7 @@ class OnServerWorker extends \Kiri\Server\Abstracts\Server
|
||||
protected function system_mail($messageContent): void
|
||||
{
|
||||
try {
|
||||
$email = Config::get('email', ['enable' => false]);
|
||||
$email = \config('email', ['enable' => false]);
|
||||
if (!empty($email) && ($email['enable'] ?? false)) {
|
||||
Help::sendEmail($email, 'Service Error', $messageContent);
|
||||
}
|
||||
|
||||
+3
-4
@@ -5,7 +5,6 @@ namespace Kiri\Server;
|
||||
|
||||
use Exception;
|
||||
use Kiri;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Events\EventDispatch;
|
||||
use Kiri\Exception\ConfigException;
|
||||
use Kiri\Router\Router;
|
||||
@@ -41,7 +40,7 @@ class Server
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->class = Config::get('server.type', AsyncServer::class);
|
||||
$this->class = \config('server.type', AsyncServer::class);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +77,7 @@ class Server
|
||||
$manager->scan_build_route();
|
||||
|
||||
$manager = $this->manager();
|
||||
$manager->initCoreServers(Config::get('server', [], true), $this->daemon);
|
||||
$manager->initCoreServers(\config('server', [], true), $this->daemon);
|
||||
$manager->start();
|
||||
}
|
||||
|
||||
@@ -121,7 +120,7 @@ class Server
|
||||
*/
|
||||
public function shutdown(): void
|
||||
{
|
||||
$configs = Config::get('server', [], true);
|
||||
$configs = \config('server', [], true);
|
||||
|
||||
$state = Kiri::getDi()->get(State::class);
|
||||
foreach ($this->manager()->sortService($configs['ports'] ?? []) as $config) {
|
||||
|
||||
@@ -4,7 +4,6 @@ namespace Kiri\Server;
|
||||
|
||||
use Exception;
|
||||
use Kiri\Abstracts\Component;
|
||||
use Kiri\Abstracts\Config;
|
||||
use Kiri\Abstracts\Logger;
|
||||
use Kiri\Server\Abstracts\TraitServer;
|
||||
use Swoole\Process;
|
||||
@@ -23,7 +22,7 @@ class State extends Component
|
||||
*/
|
||||
public function init(): void
|
||||
{
|
||||
$this->servers = Config::get('server.ports');
|
||||
$this->servers = \config('server.ports');
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user