Skip to content

Commit

Permalink
fix: showcase of ssl with mwtsc (#4082)
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed Sep 21, 2024
1 parent 5c54249 commit 3bd71f8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/mock/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const { join } = require('path');
process.send({
title: 'server-ready',
port: process.env.MIDWAY_HTTP_PORT,
ssl: args.ssl,
ssl: args.ssl || process.env.MIDWAY_HTTP_SSL === 'true',
});

function onSignal() {
Expand Down
1 change: 1 addition & 0 deletions packages/web-express/src/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ export class MidwayExpressFramework extends BaseFramework<
serverOptions.key = PathFileUtil.getFileContentSync(serverOptions.key);
serverOptions.cert = PathFileUtil.getFileContentSync(serverOptions.cert);
serverOptions.ca = PathFileUtil.getFileContentSync(serverOptions.ca);
process.env.MIDWAY_HTTP_SSL = 'true';

if (serverOptions.http2) {
this.server = require('http2').createSecureServer(
Expand Down
1 change: 1 addition & 0 deletions packages/web-koa/src/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ export class MidwayKoaFramework extends BaseFramework<
serverOptions.key = PathFileUtil.getFileContentSync(serverOptions.key);
serverOptions.cert = PathFileUtil.getFileContentSync(serverOptions.cert);
serverOptions.ca = PathFileUtil.getFileContentSync(serverOptions.ca);
process.env.MIDWAY_HTTP_SSL = 'true';

if (serverOptions.http2) {
this.server = require('http2').createSecureServer(
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/framework/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ export class MidwayWebFramework extends BaseFramework<
serverOptions.cert
);
serverOptions.ca = PathFileUtil.getFileContentSync(serverOptions.ca);
process.env.MIDWAY_HTTP_SSL = 'true';

if (serverOptions.http2) {
this.server = require('http2').createSecureServer(
Expand Down

0 comments on commit 3bd71f8

Please sign in to comment.