Add private-mode option for server command

This commit is contained in:
crazywhalecc
2022-03-29 02:10:09 +08:00
committed by Jerry Ma
parent 42aac802dd
commit e8bd381907
2 changed files with 10 additions and 5 deletions

View File

@@ -47,6 +47,7 @@ class RunServerCommand extends Command
new InputOption('force-load-module', null, InputOption::VALUE_OPTIONAL, '强制打包状态下加载模块(使用英文逗号分割多个)'),
new InputOption('polling-watch', null, null, '强制启用轮询模式监听'),
new InputOption('no-state-check', null, null, '关闭启动前框架运行状态检查'),
new InputOption('private-mode', null, null, '启动时隐藏MOTD和敏感信息'),
]);
$this->setDescription('Run zhamao-framework | 启动框架');
$this->setHelp('直接运行可以启动');

View File

@@ -144,9 +144,9 @@ class Framework
$this->server_set['log_level'] = SWOOLE_LOG_DEBUG;
$add_port = ZMConfig::get('global', 'remote_terminal')['status'] ?? false;
// if ($instant_mode) {
$this->loadServerEvents();
// }
if (!$instant_mode) {
$this->loadServerEvents();
}
$this->parseCliArgs(self::$argv, $add_port);
@@ -205,7 +205,9 @@ class Framework
$out['terminal'] = $conf['host'] . ':' . $conf['port'];
}
self::printProps($out, $tty_width, $args['log-theme'] === null);
if (!self::$argv['private-mode']) {
self::printProps($out, $tty_width, $args['log-theme'] === null);
}
if ($args['preview'] ?? false) {
exit();
}
@@ -294,7 +296,9 @@ class Framework
self::$server->set($this->server_set);
Console::setServer(self::$server);
self::printMotd($tty_width);
if (!self::$argv['private-mode']) {
self::printMotd($tty_width);
}
global $asd;
$asd = get_included_files();