mirror of
https://github.com/certd/certd.git
synced 2026-05-16 05:07:32 +08:00
perf: 支持同时监听https端口,7002
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import { Autoload, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { App, Autoload, Config, Init, Inject, Scope, ScopeEnum } from '@midwayjs/core';
|
||||
import { getPlusInfo, isPlus, logger } from '@certd/pipeline';
|
||||
import { SysInstallInfo, SysSettingsService } from '@certd/lib-server';
|
||||
import { getVersion } from '../../utils/version.js';
|
||||
import dayjs from 'dayjs';
|
||||
import { Application } from '@midwayjs/koa';
|
||||
import { HttpsServerOptions, startHttpsServer } from './https/server.js';
|
||||
|
||||
@Autoload()
|
||||
@Scope(ScopeEnum.Singleton)
|
||||
@@ -10,8 +12,17 @@ export class AutoZPrint {
|
||||
@Inject()
|
||||
sysSettingsService: SysSettingsService;
|
||||
|
||||
@App()
|
||||
app: Application;
|
||||
|
||||
@Config('https')
|
||||
httpsConfig: HttpsServerOptions;
|
||||
|
||||
@Init()
|
||||
async init() {
|
||||
//监听https
|
||||
this.startHttpsServer();
|
||||
|
||||
const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
|
||||
logger.info('=========================================');
|
||||
logger.info('当前站点ID:', installInfo.siteId);
|
||||
@@ -24,4 +35,15 @@ export class AutoZPrint {
|
||||
logger.info('Certd已启动');
|
||||
logger.info('=========================================');
|
||||
}
|
||||
|
||||
async startHttpsServer() {
|
||||
if (!this.httpsConfig.enabled) {
|
||||
logger.info('Https server is not enabled');
|
||||
return;
|
||||
}
|
||||
await startHttpsServer({
|
||||
...this.httpsConfig,
|
||||
app: this.app,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user