Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions base-service/lib/fiatrateproviders/ows.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const config = require('config');
const owsCommon = require('@owstack/ows-common');
const lodash = owsCommon.deps.lodash;

Expand All @@ -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
}
}
Expand Down
19 changes: 8 additions & 11 deletions config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}}',
}
},

Expand All @@ -61,17 +60,19 @@ 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.

BTC: {
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 || ''
}
}
Expand All @@ -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 || ''
}
}
Expand All @@ -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 || ''
}
}
Expand Down
11 changes: 6 additions & 5 deletions test/integration/fiatrateservice.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const config = require('config');
const chai = require('chai');
const sinon = require('sinon');
const should = chai.should();
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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({
Expand Down