diff --git a/lib/core/config.js b/lib/core/config.js index fc7c2847..883a58ef 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -75,19 +75,24 @@ Config.prototype.loadBlockchainConfigFile = function() { Config.prototype.loadContractsConfigFile = function() { var configObject = { - "versions": { - "web3.js": "0.19.1", - "solc": "0.4.17" - }, - "deployment": { - "host": "localhost", - "port": 8545, - "type": "rpc" - }, - "dappConnection": [ - "$WEB3", - "localhost:8545" - ] + "default": { + "versions": { + "web3.js": "1.0.0-beta", + "solc": "0.4.17" + }, + "deployment": { + "host": "localhost", + "port": 8545, + "type": "rpc" + }, + "dappConnection": [ + "$WEB3", + "localhost:8545" + ], + "gas": "auto", + "contracts": { + } + } }; var configPlugins = this.plugins.getPluginsFor('contractsConfig'); @@ -99,8 +104,11 @@ Config.prototype.loadContractsConfigFile = function() { }); } - var contractsConfig = fs.readJSONSync(this.configDir + "contracts.json"); - configObject = utils.recursiveMerge(configObject, contractsConfig); + var 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 envContractsConfig = configObject[this.env]; diff --git a/test/config.js b/test/config.js index cffc1f63..eb04d970 100644 --- a/test/config.js +++ b/test/config.js @@ -36,6 +36,9 @@ describe('embark.Config', function() { it('should load contract config correctly', function() { config.loadContractsConfigFile(); 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", "contracts": { "SimpleStorage": {