Skip to content

Commit f82d185

Browse files
Merge pull request #505 from aarong-av/aarong-av/donfigurable-default-port
Adding a configurable default electron port.
2 parents 550e2c2 + b803e42 commit f82d185

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ElectronNET.Host/main.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,16 @@ app.on('ready', () => {
7777
if (isSplashScreenEnabled()) {
7878
startSplashScreen();
7979
}
80-
81-
// hostname needs to belocalhost, otherwise Windows Firewall will be triggered.
82-
portscanner.findAPortNotInUse(8000, 65535, 'localhost', function (error, port) {
80+
// Added default port as configurable for port restricted environments.
81+
let defaultElectronPort = 8000;
82+
if (manifestJsonFile.electronPort) {
83+
defaultElectronPort = (manifestJsonFile.electronPort)
84+
}
85+
// hostname needs to be localhost, otherwise Windows Firewall will be triggered.
86+
portscanner.findAPortNotInUse(defaultElectronPort, 65535, 'localhost', function (error, port) {
8387
console.log('Electron Socket IO Port: ' + port);
8488
startSocketApiBridge(port);
8589
});
86-
8790
});
8891

8992
app.on('quit', async (event, exitCode) => {

0 commit comments

Comments
 (0)