From e7009c3c844ba1867231e16e0e08e607e1e9c58e Mon Sep 17 00:00:00 2001 From: bangbang93 Date: Thu, 28 Nov 2024 17:51:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3byoc=E4=BD=86=E6=98=AF?= =?UTF-8?q?=E8=87=AA=E5=B8=A6=E8=AF=81=E4=B9=A6=E7=9A=84=E7=9B=91=E5=90=AC?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bootstrap.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/bootstrap.ts b/src/bootstrap.ts index 43d0d4a..ed7f715 100644 --- a/src/bootstrap.ts +++ b/src/bootstrap.ts @@ -41,15 +41,18 @@ export async function bootstrap(version: string): Promise { cluster.gcBackground(files) cluster.connect() - const proto = config.byoc ? 'http' : 'https' - if (proto === 'https') { - if (config.sslCert && config.sslKey) { - logger.debug('使用自定义证书') - await cluster.useSelfCert() + let proto: 'http' | 'https' = 'https' + if (config.byoc) { + // 当BYOC但是没有提供证书时,使用http + if (!config.sslCert || !config.sslKey) { + proto = 'http' } else { - logger.info('请求证书') - await cluster.requestCert() + logger.info('使用自定义证书') + await cluster.useSelfCert() } + } else { + logger.info('请求证书') + await cluster.requestCert() } if (config.enableNginx) {