Skip to content

Commit

Permalink
fix: 修正byoc但是自带证书的监听逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbang93 committed Nov 28, 2024
1 parent ddf9a27 commit e7009c3
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,18 @@ export async function bootstrap(version: string): Promise<void> {
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) {
Expand Down

0 comments on commit e7009c3

Please sign in to comment.