Fetch the repository succeeded.
import log4js from "common-log4js";
import { basename } from "path";
const logger = log4js.getLogger(basename(__filename));
///////////////////////////////////////////////////////
import config = require("./config.json");
import { server_report_async, IServerReq, server_manager_start_async, init_manage_server_config } from "common-manager"
import { server_start as http_server_start } from "./server/httpSvr";
import { server_start as ws_server_start } from "./server/wsSvr";
import { SERVER_NAME, SERVER_REMARK, DEPEND_SERVERS } from "./interface/servers";
import { ConnectionOptions, createConnection } from "typeorm";
import { createRedisClient } from "common-redis";
(async () => {
logger.info("==========================程序 启动 开始==========================");
const serverInfo: IServerReq = {
server_type: SERVER_NAME,
server_id: SERVER_NAME + "|" + (process.env.NODE_APP_INSTANCE ? process.env.NODE_APP_INSTANCE : "0"),
tick_time: 0,
http_ip: config.http_ip,
http_port: config.http_port,
ws_ip: config.ws_ip,
ws_port: config.ws_port,
load: 0,
memory: "",
remark: SERVER_REMARK,
};
const option: ConnectionOptions = {
type: "mysql",
entities: [
"src/entity/**/*.*s",
],
};
Object.assign(option, config.ormconfig);
await createConnection(option);
// 连接redis
createRedisClient(config.redisconfig);
// 开启http服务
http_server_start(config.http_ip, config.http_port);
// 开启ws服务
ws_server_start(config.ws_port);
// 注册服务
const manage_server = config.manage_server;
await server_report_async(serverInfo, manage_server.http_ip, manage_server.http_port, config.tick_time / 10);
// 管理依赖服务
init_manage_server_config(manage_server.http_ip, manage_server.http_port);
await server_manager_start_async([
DEPEND_SERVERS.HALL_SERVER,
], config.tick_time);
logger.info("==========================程序 启动 完毕==========================");
})()
process.on('uncaughtException', function (err) {
logger.fatal("uncaughtException=======================>\n", err);
});
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。