diff --git a/lib/core/config.js b/lib/core/config.js index c6aafe594..89a66c36b 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -47,6 +47,7 @@ Config.prototype.loadConfigFiles = function(options) { this.loadPipelineConfigFile(); this.loadContractsConfigFile(); + this.loadExternalContractsFiles(); this.loadWebServerConfigFile(); this.loadChainTrackerFile(); this.loadPluginContractFiles(); @@ -60,6 +61,7 @@ Config.prototype.reloadConfig = function() { this.loadContractsConfigFile(); this.loadPipelineConfigFile(); this.loadContractsConfigFile(); + this.loadExternalContractsFiles(); this.loadChainTrackerFile(); }; @@ -140,6 +142,16 @@ Config.prototype.loadContractsConfigFile = function() { this.contractsConfig = this._mergeConfig(configFilePath, configObject, this.env); }; +Config.prototype.loadExternalContractsFiles = function() { + let contracts = this.contractsConfig.contracts; + for (let contractName in contracts) { + let contract = contracts[contractName]; + if (contract.file) { + this.contractsFiles.push(new File({filename: contract.file, type: "dapp_file", basedir: '', path: contract.file})); + } + } +}; + Config.prototype.loadStorageConfigFile = function() { var versions = utils.recursiveMerge({"ipfs-api": "17.2.4"}, this.embarkConfig.versions || {}); diff --git a/test_apps/test_app/config/contracts.json b/test_apps/test_app/config/contracts.json index d504a8ff2..8ab61e189 100644 --- a/test_apps/test_app/config/contracts.json +++ b/test_apps/test_app/config/contracts.json @@ -62,6 +62,12 @@ ["$MyToken2", "$SimpleStorage"], 100 ] + }, + "SimpleStorageTest": { + "file": "./some_folder/test_contract.sol", + "args": [ + 1000 + ] } }, "afterDeploy": [