mirror of https://github.com/embarklabs/embark.git
Add support for infura network hosts with api key.
Fix bug with non-development code generation.
This commit is contained in:
parent
b56def7c57
commit
ba66d763fe
|
@ -1,7 +1,6 @@
|
||||||
const Web3 = require('web3');
|
const Web3 = require('web3');
|
||||||
const async = require('async');
|
const async = require('async');
|
||||||
const Provider = require('./provider.js');
|
const Provider = require('./provider.js');
|
||||||
const http = require('http');
|
|
||||||
const BlockchainProcessLauncher = require('../processes/blockchainProcessLauncher');
|
const BlockchainProcessLauncher = require('../processes/blockchainProcessLauncher');
|
||||||
const utils = require('../utils/utils');
|
const utils = require('../utils/utils');
|
||||||
const constants = require('../constants');
|
const constants = require('../constants');
|
||||||
|
@ -274,8 +273,16 @@ class Blockchain {
|
||||||
Origin: origin
|
Origin: origin
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
let req;
|
||||||
const req = http.get(options);
|
// remove trailing api key from infura, ie rinkeby.infura.io/nmY8WtT4QfEwz2S7wTbl
|
||||||
|
if(options.host.indexOf('/') > -1){
|
||||||
|
options.host = options.host.split('/')[0];
|
||||||
|
}
|
||||||
|
if((self.contractsConfig.deployment.protocol || 'http') === 'https'){
|
||||||
|
req = require('https').get(options);
|
||||||
|
}else{
|
||||||
|
req = require('http').get(options);
|
||||||
|
}
|
||||||
|
|
||||||
req.on('error', (err) => {
|
req.on('error', (err) => {
|
||||||
next(err);
|
next(err);
|
||||||
|
|
|
@ -137,7 +137,7 @@ class CodeGenerator {
|
||||||
if (self.env === 'development') {
|
if (self.env === 'development') {
|
||||||
web3Load = Templates.web3_connector({connectionList: connectionList, done: 'done();', warnAboutMetamask: true});
|
web3Load = Templates.web3_connector({connectionList: connectionList, done: 'done();', warnAboutMetamask: true});
|
||||||
} else {
|
} else {
|
||||||
web3Load = Templates.web3_connector({connectionList: connectionList, done: 'done();'});
|
web3Load = Templates.web3_connector({connectionList: connectionList, done: 'done();', warnAboutMetamask: true});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue