File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
packages/redux-devtools-cli/src Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change 11import express from 'express' ;
2- import http from 'http' ;
32import getPort from 'get-port' ;
43import socketClusterServer from 'socketcluster-server' ;
54import getOptions from './options.js' ;
65import routes from './routes.js' ;
76import createStore from './store.js' ;
7+ import { createServer } from './utils/create-server.js' ;
88
99// const LOG_LEVEL_NONE = 0;
1010// const LOG_LEVEL_ERROR = 1;
@@ -37,7 +37,8 @@ export default async function (argv: { [arg: string]: any }): Promise<{
3737 console . log ( '[ReduxDevTools] Start server...' ) ;
3838 console . log ( '-' . repeat ( 80 ) + '\n' ) ;
3939 }
40- const httpServer = http . createServer ( ) ;
40+
41+ const httpServer = createServer ( argv ) ;
4142 const agServer = socketClusterServer . attach ( httpServer , options ) ;
4243
4344 const app = express ( ) ;
Original file line number Diff line number Diff line change 1+ import http from 'http' ;
2+ import https from 'https' ;
3+
4+ export const createServer = ( argv : { [ arg : string ] : unknown } ) : http . Server | https . Server => {
5+ const typedArgv = argv as {
6+ protocol : string ;
7+ key : string ;
8+ cert : string ;
9+ } ;
10+
11+ let result ;
12+
13+ if ( typedArgv . protocol === 'https' ) {
14+ const options = {
15+ key : typedArgv . key ,
16+ cert : typedArgv . cert ,
17+ } ;
18+
19+ result = https . createServer ( options ) ;
20+ } else {
21+ result = http . createServer ( ) ;
22+ }
23+
24+ return result ;
25+ }
You can’t perform that action at this time.
0 commit comments