diff --git a/base-service/lib/fiatrateproviders/ows.js b/base-service/lib/fiatrateproviders/ows.js index 362ee0a..d172390 100644 --- a/base-service/lib/fiatrateproviders/ows.js +++ b/base-service/lib/fiatrateproviders/ows.js @@ -1,3 +1,4 @@ +const config = require('config'); const owsCommon = require('@owstack/ows-common'); const lodash = owsCommon.deps.lodash; @@ -18,15 +19,15 @@ const provider = { name: 'OpenWalletStack', currency: { BCH: { - url: 'http://rates.owstack.org/buy/gdax,bitstamp/bchusd/1', + url: `${config.rateServiceOpts.url}/buy/gdax,bitstamp/bchusd/1`, parseFn: parseFn }, BTC: { - url: 'http://rates.owstack.org/buy/gdax,bitstamp/btcusd/1', + url: `${config.rateServiceOpts.url}/buy/gdax,bitstamp/btcusd/1`, parseFn: parseFn }, LTC: { - url: 'http://rates.owstack.org/buy/gdax,bitstamp/ltcusd/1', + url: `${config.rateServiceOpts.url}/buy/gdax,bitstamp/ltcusd/1`, parseFn: parseFn } } diff --git a/config/default.js b/config/default.js index 97ae04a..cc8c66d 100644 --- a/config/default.js +++ b/config/default.js @@ -43,8 +43,7 @@ const config = { from: process.env.EMAIL_FROM || 'wallet-service@owstack.com', templatePath: process.env.EMAIL_TEMPLATE_DIR || './base-service/lib/templates', publicTxUrlTemplate: { - livenet: process.env.EMAIL_EXPLORER_URL_TEMPLATE || 'http://explorer.owstack.org/explorer/tx/{{txid}}', - // testnet: 'http://explorer.owstack.org/explorer/tx/{{txid}}' + livenet: process.env.EMAIL_EXPLORER_URL_TEMPLATE || 'http://dev.owstack.org/explorer/btc/tx/{{txid}}', } }, @@ -61,6 +60,10 @@ const config = { fetchInterval: 60 // in minutes }, + rateServiceOpts: { + url: process.env.RATE_SERVICE_URL || 'http://rate-service' + }, + // Each server (by coin network) has it's own configuration. Where the same services // run for each coin network the url's must be unique across all coin networks. @@ -68,10 +71,8 @@ const config = { blockchainExplorerOpts: { defaultProvider: 'explorer', explorer: { - // Multiple servers (in priority order) - // url: ['http://a.b.c', 'https://test-explorer.owstack.com:443'], livenet: { - url: process.env.BTC_LIVENET_EXPLORER_API || 'https://btc.livenet.explorer-api.owstack.org', + url: process.env.BTC_LIVENET_EXPLORER_API || 'http://btc-explorer-api', apiPrefix: process.env.BTC_LIVENET_EXPLORER_API_PATH || '' } } @@ -82,10 +83,8 @@ const config = { blockchainExplorerOpts: { defaultProvider: 'explorer', explorer: { - // Multiple servers (in priority order) - // url: ['http://a.b.c', 'https://test-explorer.owstack.com:443'], livenet: { - url: process.env.BCH_LIVENET_EXPLORER_API || 'http://bch.livenet.explorer-api.owstack.org', + url: process.env.BCH_LIVENET_EXPLORER_API || 'http://bch-explorer-api', apiPrefix: process.env.BCH_LIVENET_EXPLORER_API_PATH || '' } } @@ -96,10 +95,8 @@ const config = { blockchainExplorerOpts: { defaultProvider: 'explorer', explorer: { - // Multiple servers (in priority order) - // url: ['http://a.b.c', 'https://test-explorer.owstack.com:443'], livenet: { - url: process.env.LTC_LIVENET_EXPLORER_API || 'http://ltc.livenet.explorer-api.owstack.org', + url: process.env.LTC_LIVENET_EXPLORER_API || 'http://ltc-explorer-api', apiPrefix: process.env.LTC_LIVENET_EXPLORER_API_PATH || '' } } diff --git a/test/integration/fiatrateservice.js b/test/integration/fiatrateservice.js index f04dcef..f203f90 100644 --- a/test/integration/fiatrateservice.js +++ b/test/integration/fiatrateservice.js @@ -1,3 +1,4 @@ +const config = require('config'); const chai = require('chai'); const sinon = require('sinon'); const should = chai.should(); @@ -236,7 +237,7 @@ describe('Fiat rate service', function () { json: true }).yields(null, null, bitstamp); request.get.withArgs({ - url: 'http://rates.owstack.org/buy/gdax,bitstamp/btcusd/1', + url: `${config.rateServiceOpts.url }/buy/gdax,bitstamp/btcusd/1`, json: true }).yields(null, null, openwalletstack); @@ -374,17 +375,17 @@ describe('Fiat rate service', function () { }]; request.get.withArgs({ - url: 'http://rates.owstack.org/buy/gdax,bitstamp/btcusd/1', + url: `${config.rateServiceOpts.url}/buy/gdax,bitstamp/btcusd/1`, json: true }).yields(null, null, owsBTC); request.get.withArgs({ - url: 'http://rates.owstack.org/buy/gdax,bitstamp/bchusd/1', + url: `${config.rateServiceOpts.url}/buy/gdax,bitstamp/bchusd/1`, json: true }).yields(null, null, owsBCH); request.get.withArgs({ - url: 'http://rates.owstack.org/buy/gdax,bitstamp/ltcusd/1', + url: `${config.rateServiceOpts.url}/buy/gdax,bitstamp/ltcusd/1`, json: true }).yields(null, null, owsLTC); @@ -433,7 +434,7 @@ describe('Fiat rate service', function () { last: 120.00, }; request.get.withArgs({ - url: 'http://rates.owstack.org/buy/gdax,bitstamp/btcusd/1', + url: `${config.rateServiceOpts.url }/buy/gdax,bitstamp/btcusd/1`, json: true }).yields('dummy error', null, null); request.get.withArgs({