diff --git a/packages/embark/src/lib/core/config.js b/packages/embark/src/lib/core/config.js index 5b5c51f0d..e0f41e50b 100644 --- a/packages/embark/src/lib/core/config.js +++ b/packages/embark/src/lib/core/config.js @@ -434,6 +434,7 @@ Config.prototype.loadCommunicationConfigFile = function() { let configFilePath = this._getFileOrObject(this.configDir, 'communication', 'communication'); this.communicationConfig = this._mergeConfig(configFilePath, configObject, this.env); + this.events.emit('config:load:communication', this.communicationConfig); }; Config.prototype.loadWebServerConfigFile = function() { diff --git a/packages/embark/src/lib/modules/code_generator/index.js b/packages/embark/src/lib/modules/code_generator/index.js index c10a92361..c7111f5d0 100644 --- a/packages/embark/src/lib/modules/code_generator/index.js +++ b/packages/embark/src/lib/modules/code_generator/index.js @@ -52,6 +52,10 @@ class CodeGenerator { this.generateStorageConfig(storageConfig); }); + this.events.on('config:load:communication', (communicationConfig) => { + this.generateCommunicationConfig(communicationConfig); + }); + this.events.setCommandHandler('code', function(cb) { self.events.request("contracts:list", (_err, contractsList) => { let embarkJSABI = self.generateABI(contractsList, {useEmbarkJS: true}); @@ -167,6 +171,13 @@ class CodeGenerator { this.generateConfig(this.dappConfigs.storage, constants.dappConfig.storage); } + generateCommunicationConfig(communicationConfig) { + this.dappConfigs.communication = { + connection: communicationConfig.connection + }; + this.generateConfig(this.dappConfigs.communication, constants.dappConfig.communication); + } + generateConfig(configObj, filepathName) { const dir = utils.joinPath(this.embarkConfig.generationDir, constants.dappConfig.dir); const filePath = utils.joinPath(dir, filepathName);