This commit is contained in:
Josh Harvey 2016-10-10 14:53:01 +01:00
parent c057fe3df8
commit 259b527214
6 changed files with 68 additions and 81 deletions

View file

@ -11,7 +11,7 @@ const db = require('./postgresql_interface')
const logger = require('./logger')
const notifier = require('./notifier')
const T = require('./time')
const config = require('./config')
const configManager = require('./config-manager')
const tradeIntervals = {}
@ -166,13 +166,12 @@ function loadOrConfigPlugin (pluginHandle, pluginType, cryptoCode, cfg, accounts
exports.loadOrConfigPlugin = loadOrConfigPlugin
// Note: this whole function gets called every time there's a config update
exports.configure = function configure (cfg) {
if (config.exchanges.settings.lowBalanceMargin < 1) {
throw new Error('\'settings.lowBalanceMargin\' has to be >= 1')
}
exports.configure = function configure (config) {
console.log('DEBUG4: %j', config)
cachedConfig = cfg
const accounts = config.loadAccounts()
cachedConfig = config
const accounts = configManager.loadAccounts()
deviceCurrency = config.fiat.fiatCurrency
cryptoCodes = config.crypto.cryptoCurrencies
@ -255,8 +254,10 @@ exports.configure = function configure (cfg) {
)
}
exports.getConfig = function getConfig () {
return cachedConfig
exports.getConfig = function getConfig (machineId) {
console.log('DEBUG3: %j', cachedConfig)
console.log('DEBUG55: %j', configManager.machineScoped(machineId, cachedConfig))
return configManager.machineScoped(machineId, cachedConfig)
}
exports.logEvent = db.recordDeviceEvent