Merge pull request #813 from embark-framework/feature/ipc-webserver-restriction

No webserver and no ipc server on console
This commit is contained in:
Anthony Laibe 2018-09-13 09:44:55 +01:00 committed by GitHub
commit 323ec0d529
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 29 deletions

View File

@ -79,7 +79,8 @@ class EmbarkController {
context: self.context,
useDashboard: options.useDashboard,
webServerConfig: webServerConfig,
webpackConfigName: options.webpackConfigName
webpackConfigName: options.webpackConfigName,
ipcRole: 'server'
});
async.waterfall([
@ -269,28 +270,24 @@ class EmbarkController {
engine.logger.info(__("loaded plugins") + ": " + pluginList.join(", "));
}
engine.ipc.connect((err) => {
if (err) {
engine.startService("processManager");
engine.startService("serviceMonitor");
engine.startService("libraryManager");
engine.startService("codeRunner");
engine.startService("web3");
engine.startService("pipeline");
engine.startService("deployment");
engine.startService("storage");
engine.startService("codeGenerator");
engine.startService("webServer");
engine.startService("namingSystem");
engine.startService("console");
engine.startService("pluginCommand");
return callback();
}
if (engine.ipc.connected) {
engine.startService("codeRunner");
engine.startService("console");
callback();
});
return callback();
}
engine.startService("processManager");
engine.startService("serviceMonitor");
engine.startService("libraryManager");
engine.startService("codeRunner");
engine.startService("web3");
engine.startService("pipeline");
engine.startService("deployment");
engine.startService("storage");
engine.startService("codeGenerator");
engine.startService("namingSystem");
engine.startService("console");
engine.startService("pluginCommand");
callback();
},
function web3IPC(callback) {
// Do specific work in case we are connected to a socket:

View File

@ -18,6 +18,7 @@ class Engine {
this.useDashboard = options.useDashboard;
this.webServerConfig = options.webServerConfig;
this.webpackConfigName = options.webpackConfigName;
this.ipcRole = options.ipcRole || 'client';
}
init(_options, callback) {
@ -38,14 +39,16 @@ class Engine {
utils.interceptLogs(console, this.logger);
}
this.ipc = new IPC({logger: this.logger, ipcRole: 'client'});
this.ipc.connect((err) => {
if(err) {
this.ipc = new IPC({logger: this.logger, ipcRole: 'server'});
this.ipc.serve();
}
callback();
});
this.ipc = new IPC({logger: this.logger, ipcRole: this.ipcRole});
if (this.ipc.isClient()) {
return this.ipc.connect((_err) => {
callback();
});
} else if (this.ipc.isServer()) {
this.ipc.serve();
return callback();
}
callback();
}
registerModule(moduleName, options) {