ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [44/49] ignite git commit: IGNITE-5697 Web Console: Added host configuration.
Date Tue, 01 Aug 2017 10:37:44 GMT
IGNITE-5697 Web Console: Added host configuration.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0376c48f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0376c48f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0376c48f

Branch: refs/heads/ignite-5578
Commit: 0376c48f056fd11ec6827211725a44533fb75ee1
Parents: d4a70a8
Author: Andrey Novikov <anovikov@gridgain.com>
Authored: Mon Jul 31 15:17:12 2017 +0700
Committer: Andrey Novikov <anovikov@gridgain.com>
Committed: Mon Jul 31 15:17:12 2017 +0700

----------------------------------------------------------------------
 modules/web-console/backend/app/settings.js |  3 ++-
 modules/web-console/backend/index.js        | 20 +++++++-------------
 2 files changed, 9 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0376c48f/modules/web-console/backend/app/settings.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/app/settings.js b/modules/web-console/backend/app/settings.js
index 94f3d90..05cb7f6 100644
--- a/modules/web-console/backend/app/settings.js
+++ b/modules/web-console/backend/app/settings.js
@@ -54,6 +54,7 @@ module.exports.factory = function(nconf, fs) {
             dists: 'agent_dists'
         },
         server: {
+            host: nconf.get('server:host') || '127.0.0.1',
             port: _normalizePort(nconf.get('server:port') || 3000),
             SSLOptions: nconf.get('server:ssl') && {
                 enable301Redirects: true,
@@ -64,7 +65,7 @@ module.exports.factory = function(nconf, fs) {
             }
         },
         mail,
-        mongoUrl: nconf.get('mongodb:url') || 'mongodb://localhost/console',
+        mongoUrl: nconf.get('mongodb:url') || 'mongodb://127.0.0.1/console',
         cookieTTL: 3600000 * 24 * 30,
         sessionSecret: nconf.get('server:sessionSecret') || 'keyboard cat',
         tokenLength: 20

http://git-wip-us.apache.org/repos/asf/ignite/blob/0376c48f/modules/web-console/backend/index.js
----------------------------------------------------------------------
diff --git a/modules/web-console/backend/index.js b/modules/web-console/backend/index.js
index 18bb24d..f6ba439 100644
--- a/modules/web-console/backend/index.js
+++ b/modules/web-console/backend/index.js
@@ -41,21 +41,19 @@ catch (ignore) {
 /**
  * Event listener for HTTP server "error" event.
  */
-const _onError = (port, error) => {
+const _onError = (addr, error) => {
     if (error.syscall !== 'listen')
         throw error;
 
-    const bind = typeof port === 'string' ? 'Pipe ' + port : 'Port ' + port;
-
     // Handle specific listen errors with friendly messages.
     switch (error.code) {
         case 'EACCES':
-            console.error(bind + ' requires elevated privileges');
+            console.error(`Requires elevated privileges for bind to ${addr}`);
             process.exit(1);
 
             break;
         case 'EADDRINUSE':
-            console.error(bind + ' is already in use');
+            console.error(`${addr} is already in use`);
             process.exit(1);
 
             break;
@@ -83,16 +81,12 @@ const init = ([settings, apiSrv, agentsHnd, browsersHnd]) => {
     // Start rest server.
     const srv = settings.server.SSLOptions ? https.createServer(settings.server.SSLOptions)
: http.createServer();
 
-    srv.listen(settings.server.port);
-
-    srv.on('error', _onError.bind(null, settings.server.port));
-    srv.on('listening', _onListening.bind(null, srv.address()));
+    srv.listen(settings.server.port, settings.server.host);
 
-    process.on('unhandledRejection', (error) => {
-        // Will print "unhandledRejection err is not defined"
-        console.log('unhandledRejection', error);
-    });
+    const addr = `${settings.server.host}:${settings.server.port}`;
 
+    srv.on('error', _onError.bind(null, addr));
+    srv.on('listening', () => console.log(`Start listening on ${addr}`));
 
     apiSrv.attach(srv);
 


Mime
View raw message