improve config loading; remove debug

This commit is contained in:
Josh Harvey 2017-04-25 02:25:32 +03:00
parent 5f0b70ca42
commit 614c64646a
15 changed files with 198 additions and 193 deletions

View file

@ -2,13 +2,16 @@ const configManager = require('./config-manager')
const ph = require('./plugin-helper')
function lookupExchange (settings, cryptoCode) {
return configManager.cryptoScoped(cryptoCode, settings.config).exchange
const exchange = configManager.cryptoScoped(cryptoCode, settings.config).exchange
if (exchange === 'no-exchange') return null
return exchange
}
function fetchExchange (settings, cryptoCode) {
return Promise.resolve()
.then(() => {
const plugin = lookupExchange(settings, cryptoCode)
if (!plugin) throw new Error('No exchange set')
const exchange = ph.load(ph.EXCHANGE, plugin)
const account = settings.accounts[plugin]