feat: add httpPort & httpsPort options
This commit is contained in:
		
							parent
							
								
									63712121af
								
							
						
					
					
						commit
						68fbfd68aa
					
				@ -6,6 +6,8 @@
 | 
			
		||||
    "__valid_levels": "fatal, error, warn, info, http, debug, trace"
 | 
			
		||||
  },
 | 
			
		||||
  "myAddress": "localhost",
 | 
			
		||||
  "httpPort": 80,
 | 
			
		||||
  "httpsPort": 443,
 | 
			
		||||
  "autoCreateAccount": true,
 | 
			
		||||
  "skipStoryModeChoice": true,
 | 
			
		||||
  "skipTutorial": true,
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								src/index.ts
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								src/index.ts
									
									
									
									
									
								
							@ -3,6 +3,7 @@ import https from "https";
 | 
			
		||||
import fs from "node:fs";
 | 
			
		||||
import { app } from "./app";
 | 
			
		||||
import { logger } from "./utils/logger";
 | 
			
		||||
import { config } from "./services/configService";
 | 
			
		||||
//const morgan = require("morgan");
 | 
			
		||||
//const bodyParser = require("body-parser");
 | 
			
		||||
 | 
			
		||||
@ -12,9 +13,14 @@ const options = {
 | 
			
		||||
    passphrase: "123456"
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const httpPort = config.httpPort || 80;
 | 
			
		||||
const httpsPort = config.httpsPort || 443;
 | 
			
		||||
 | 
			
		||||
// const server = http.createServer(app).listen(80);
 | 
			
		||||
http.createServer(app).listen(80, () => logger.info("cache server started on port 80"));
 | 
			
		||||
const server = https.createServer(options, app).listen(443, () => logger.info("game server started on port 443"));
 | 
			
		||||
http.createServer(app).listen(httpPort, () => logger.info("cache server started on port " + httpPort));
 | 
			
		||||
const server = https
 | 
			
		||||
    .createServer(options, app)
 | 
			
		||||
    .listen(httpsPort, () => logger.info("game server started on port " + httpsPort));
 | 
			
		||||
 | 
			
		||||
// server.keepAliveTimeout = 60 * 1000 + 1000;
 | 
			
		||||
// server.headersTimeout = 60 * 1000 + 2000;
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,8 @@ interface IConfig {
 | 
			
		||||
    mongodbUrl: string;
 | 
			
		||||
    logger: ILoggerConfig;
 | 
			
		||||
    myAddress: string;
 | 
			
		||||
    httpPort?: number;
 | 
			
		||||
    httpsPort?: number;
 | 
			
		||||
    autoCreateAccount?: boolean;
 | 
			
		||||
    skipStoryModeChoice?: boolean;
 | 
			
		||||
    skipTutorial?: boolean;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user