feature(@embark/code_generator) generate communication config artifact

This commit is contained in:
Iuri Matias 2019-01-31 06:06:41 +01:00
parent c9febdec93
commit 7d325ee28b
2 changed files with 12 additions and 0 deletions

View File

@ -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() {

View File

@ -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);