diff --git a/.migrate-stress b/.migrate-stress new file mode 100644 index 00000000..fa39ddf4 --- /dev/null +++ b/.migrate-stress @@ -0,0 +1 @@ +{"migrations":[{"title":"001-initial.js"},{"title":"002-bills.js"},{"title":"003-device-events.js"},{"title":"004-transactions-reload.js"},{"title":"005-addCrypto.js"},{"title":"006-add-machine-config.js"},{"title":"007-add-phone.js"},{"title":"008-add-two-way.js"},{"title":"009-update-timestamps.js"},{"title":"010-cached-requests.js"},{"title":"011-transactions-reload-2.js"},{"title":"012-add-hd-path-serial.js"},{"title":"013-add-last-checked.js"},{"title":"014-session-to-tx-id.js"},{"title":"015-paired_devices.js"},{"title":"016-new_cached_requests_table.js"},{"title":"017-user_tokens.js"},{"title":"018-alter_devices.js"},{"title":"019-remove-dispense-counts.js"},{"title":"020-add-server-events.js"},{"title":"021-config-version-id.js"},{"title":"022-add_cash_in_sent.js"},{"title":"023-add-dispenses-to-cash-out.js"},{"title":"024-consolidate-hd.js"},{"title":"025-create_trades.js"},{"title":"026-add_send_confirmed.js"},{"title":"027-tx_errors.js"},{"title":"028-cash_out_actions.js"},{"title":"029-add_valid_to_user_config.js"},{"title":"030-cash-out-provision.js"},{"title":"031-remove_name_from_devices.js"},{"title":"032-create_machine_pings_table.js"},{"title":"033-add_cash_in_fee.js"},{"title":"034-add_cash_out_error_code.js"},{"title":"035-log_bank_notes.js"}],"path":"/Users/josh/projects/lamassu-server/.migrate-stress","pos":35} \ No newline at end of file diff --git a/bin/lamassu-migrate b/bin/lamassu-migrate index 590d3121..932f63a3 100755 --- a/bin/lamassu-migrate +++ b/bin/lamassu-migrate @@ -7,6 +7,7 @@ const options = require('../lib/options') const migrateDir = path.resolve(__dirname, '..', 'migrations') const migration = migrate.load(options.migrateStatePath, migrateDir) +console.log(options.migrateStatePath) migration.up(err => { if (err) { console.error('DB Migration failed: %s', err) diff --git a/lib/admin/config.js b/lib/admin/config.js index 0ce77b09..6b2259a5 100644 --- a/lib/admin/config.js +++ b/lib/admin/config.js @@ -170,6 +170,7 @@ function fetchData () { {code: 'kraken', display: 'Kraken', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC', 'DASH', 'ZEC']}, {code: 'bitstamp', display: 'Bitstamp', class: 'ticker', cryptos: ['BTC', 'LTC']}, {code: 'coinbase', display: 'Coinbase', class: 'ticker', cryptos: ['BTC', 'ETH', 'LTC']}, + {code: 'mock-ticker', display: 'Mock ticker', class: 'ticker', cryptos: ALL_CRYPTOS}, {code: 'bitcoind', display: 'bitcoind', class: 'wallet', cryptos: ['BTC']}, {code: 'geth', display: 'geth', class: 'wallet', cryptos: ['ETH']}, {code: 'zcashd', display: 'zcashd', class: 'wallet', cryptos: ['ZEC']}, diff --git a/lib/options.js b/lib/options.js index 291ed278..b2c549b1 100644 --- a/lib/options.js +++ b/lib/options.js @@ -4,21 +4,27 @@ const os = require('os') const _ = require('lodash/fp') const argv = require('minimist')(process.argv.slice(2)) -let serverConfig +function load () { + if (argv.f) { + const configPath = argv.f + return JSON.parse(fs.readFileSync(configPath)) + } -try { - const globalConfigPath = path.resolve('/etc', 'lamassu', 'lamassu.json') - serverConfig = JSON.parse(fs.readFileSync(globalConfigPath)) -} catch (_) { try { - const homeConfigPath = path.resolve(os.homedir(), '.lamassu', 'lamassu.json') - serverConfig = JSON.parse(fs.readFileSync(homeConfigPath)) + const globalConfigPath = path.resolve('/etc', 'lamassu', 'lamassu.json') + return JSON.parse(fs.readFileSync(globalConfigPath)) } catch (_) { - console.error("Couldn't open lamassu.json config file.") - process.exit(1) + try { + const homeConfigPath = path.resolve(os.homedir(), '.lamassu', 'lamassu.json') + return JSON.parse(fs.readFileSync(homeConfigPath)) + } catch (_) { + console.error("Couldn't open lamassu.json config file.") + process.exit(1) + } } } +const serverConfig = load() const defaults = {logLevel: 'info'} const commandLine = {logLevel: argv.logLevel} diff --git a/lib/plugins/ticker/mock-ticker/mock-ticker.js b/lib/plugins/ticker/mock-ticker/mock-ticker.js new file mode 100644 index 00000000..49470e90 --- /dev/null +++ b/lib/plugins/ticker/mock-ticker/mock-ticker.js @@ -0,0 +1,12 @@ +const BN = require('../../../bn') + +function ticker (account, fiatCode, cryptoCode) { + return Promise.resolve({ + rates: { + ask: BN(105), + bid: BN(100) + } + }) +} + +module.exports = {ticker}