Merge pull request #613 from embark-framework/bug_fix/maincontext-error

Fixed __mainContext error
This commit is contained in:
Iuri Matias 2018-07-09 11:02:21 +03:00 committed by GitHub
commit 188d175735
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 7 deletions

View File

@ -106,16 +106,14 @@ class CodeGenerator {
let result = "";
let providerPlugins;
// TODO: check contractsConfig for enabled
if (self.blockchainConfig === {} || self.blockchainConfig.enabled === false) {
return "";
}
result += Templates.utils();
result += Templates.main_context();
result += Templates.load_manager();
result += Templates.define_when_env_loaded();
if (self.blockchainConfig === {} || self.blockchainConfig.enabled === false) {
return result;
}
if (this.plugins) {
providerPlugins = this.plugins.getPluginsFor('clientWeb3Provider');
@ -128,8 +126,12 @@ class CodeGenerator {
} else {
let web3Load;
if (this.contractsConfig === {} || this.contractsConfig.enabled === false) {
return result;
}
if (isDeployment) {
let connection = "http://" + this.contractsConfig.deployment.host + ":" + this.contractsConfig.deployment.port;
let connection = utils.buildUrlFromConfig(this.contractsConfig.deployment);
web3Load = Templates.define_web3_simple({url: connection, done: 'done();'});
} else {
let connectionList = "[" + this.contractsConfig.dappConnection.map((x) => '"' + x + '"').join(',') + "]";