mirror of
https://github.com/embarklabs/embark.git
synced 2025-01-15 16:24:40 +00:00
fix defaults when contracts config file is not present
This commit is contained in:
parent
e093ff5b30
commit
747237de76
@ -75,19 +75,24 @@ Config.prototype.loadBlockchainConfigFile = function() {
|
|||||||
Config.prototype.loadContractsConfigFile = function() {
|
Config.prototype.loadContractsConfigFile = function() {
|
||||||
|
|
||||||
var configObject = {
|
var configObject = {
|
||||||
"versions": {
|
"default": {
|
||||||
"web3.js": "0.19.1",
|
"versions": {
|
||||||
"solc": "0.4.17"
|
"web3.js": "1.0.0-beta",
|
||||||
},
|
"solc": "0.4.17"
|
||||||
"deployment": {
|
},
|
||||||
"host": "localhost",
|
"deployment": {
|
||||||
"port": 8545,
|
"host": "localhost",
|
||||||
"type": "rpc"
|
"port": 8545,
|
||||||
},
|
"type": "rpc"
|
||||||
"dappConnection": [
|
},
|
||||||
"$WEB3",
|
"dappConnection": [
|
||||||
"localhost:8545"
|
"$WEB3",
|
||||||
]
|
"localhost:8545"
|
||||||
|
],
|
||||||
|
"gas": "auto",
|
||||||
|
"contracts": {
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var configPlugins = this.plugins.getPluginsFor('contractsConfig');
|
var configPlugins = this.plugins.getPluginsFor('contractsConfig');
|
||||||
@ -99,8 +104,11 @@ Config.prototype.loadContractsConfigFile = function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var contractsConfig = fs.readJSONSync(this.configDir + "contracts.json");
|
var contractsConfig;
|
||||||
configObject = utils.recursiveMerge(configObject, contractsConfig);
|
if (fs.existsSync(this.configDir + "contracts.json")) {
|
||||||
|
contractsConfig = fs.readJSONSync(this.configDir + "contracts.json");
|
||||||
|
configObject = utils.recursiveMerge(configObject, contractsConfig);
|
||||||
|
}
|
||||||
var defaultContractsConfig = configObject['default'];
|
var defaultContractsConfig = configObject['default'];
|
||||||
var envContractsConfig = configObject[this.env];
|
var envContractsConfig = configObject[this.env];
|
||||||
|
|
||||||
|
@ -36,6 +36,9 @@ describe('embark.Config', function() {
|
|||||||
it('should load contract config correctly', function() {
|
it('should load contract config correctly', function() {
|
||||||
config.loadContractsConfigFile();
|
config.loadContractsConfigFile();
|
||||||
let expectedConfig = {
|
let expectedConfig = {
|
||||||
|
versions: { 'web3.js': '1.0.0-beta', solc: '0.4.17' },
|
||||||
|
deployment: { host: 'localhost', port: 8545, type: 'rpc' },
|
||||||
|
dappConnection: [ '$WEB3', 'localhost:8545' ],
|
||||||
"gas": "auto",
|
"gas": "auto",
|
||||||
"contracts": {
|
"contracts": {
|
||||||
"SimpleStorage": {
|
"SimpleStorage": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user