Skip to content

Build your personal knowledge base with Trilium Notes

load port from config file for electron

azivnera61f63b09872
diff --git a/bin/www b/bin/www
index cd21bae311..9d2f738c0f 100755
--- a/bin/www
+++ b/bin/www
@@ -16,9 +16,6 @@ const https = require('https');
const config = require('../services/config');
const log = require('../services/log');
-/**
- * Get port from environment and store in Express.
- */
const port = normalizePort(config['Network']['port'] || '3000');
app.set('port', port);
diff --git a/index.js b/index.js
index 49c2298b05..71c1279a21 100644
--- a/index.js
+++ b/index.js
@@ -1,6 +1,7 @@
'use strict';
const electron = require('electron');
const path = require('path');
+const config = require('./services/config');
const app = electron.app;
@@ -23,8 +24,10 @@ function createMainWindow() {
icon: path.join(__dirname, 'public/images/app-icons/png/256x256.png')
});
+ const port = config['Network']['port'] || '3000';
+
win.setMenu(null);
- win.loadURL('http://localhost:3000');
+ win.loadURL('http://localhost:' + port);
win.on('closed', onClosed);
win.webContents.on('new-window', (e, url) => {