Skip to content
This repository was archived by the owner on Mar 14, 2025. It is now read-only.

Commit f82b6e1

Browse files
author
ZeroWolf233
committed
fix: 同步93的修正byoc但是自带证书的监听逻辑
1 parent 0616a3f commit f82b6e1

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/bootstrap.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,20 @@ export async function bootstrap(version: string): Promise<void> {
4646
}
4747

4848
cluster.connect()
49-
const proto = config.byoc ? 'http' : 'https'
50-
if (proto === 'https') {
51-
if (config.sslCert && config.sslKey) {
52-
logger.debug('使用自定义证书')
53-
await cluster.useSelfCert()
49+
let proto: 'http' | 'https' = 'https'
50+
if (config.byoc) {
51+
// 当BYOC但是没有提供证书时,使用http
52+
if (!config.sslCert || !config.sslKey) {
53+
proto = 'http'
5454
} else {
55-
logger.info('请求证书')
56-
await cluster.requestCert()
55+
logger.info('使用自定义证书')
56+
await cluster.useSelfCert()
5757
}
58+
} else {
59+
logger.info('请求证书')
60+
await cluster.requestCert()
5861
}
62+
5963
if (config.enableNginx) {
6064
if (typeof cluster.port === 'number') {
6165
await cluster.setupNginx(join(__dirname, '..'), cluster.port, proto)

0 commit comments

Comments
 (0)