using random free port for electron app #91 #86

This commit is contained in:
Jan Prochazka
2021-04-23 20:49:52 +02:00
parent 65aa6067e1
commit 8caf5d622e
3 changed files with 10 additions and 10 deletions

View File

@@ -6,7 +6,7 @@ const http = require('http');
const cors = require('cors');
const io = require('socket.io');
const fs = require('fs');
const findFreePort = require('find-free-port');
const getPort = require('get-port');
const childProcessChecker = require('./utility/childProcessChecker');
const path = require('path');
const crypto = require('crypto');
@@ -107,7 +107,7 @@ function start() {
authorization = crypto.randomBytes(32).toString('hex');
findFreePort(53911, function (err, port) {
getPort().then(port => {
server.listen(port, () => {
console.log(`DbGate API listening on port ${port}`);
process.send({ msgtype: 'listening', port, authorization });
@@ -115,7 +115,7 @@ function start() {
});
} else if (platformInfo.isNpmDist) {
app.use(express.static(path.join(__dirname, '../../dbgate-web/public')));
findFreePort(5000, function (err, port) {
getPort({ port: 5000 }).then(port => {
server.listen(port, () => {
console.log(`DbGate API listening on port ${port}`);
});