chore: custom mempool url

This commit is contained in:
apotdevin 2021-09-28 14:26:04 +02:00
parent bc091661ce
commit dbf2da3d0d
No known key found for this signature in database
GPG key ID: 4403F1DFBE779457
4 changed files with 19 additions and 4 deletions

5
.env
View file

@ -12,6 +12,11 @@
# LOG_LEVEL='info'
# TOR_PROXY_SERVER=socks://127.0.0.1:9050
# -----------
# URLs
# -----------
# MEMPOOL_URL='https://mempool.space'
# -----------
# Interface Configs
# -----------

View file

@ -24,6 +24,10 @@ const accountConfig = {
accountConfigPath: process.env.ACCOUNT_CONFIG_PATH || '',
};
const urls = {
mempoolUrl: process.env.MEMPOOL_URL || 'https://mempool.space',
};
module.exports = {
poweredByHeader: false,
basePath: process.env.BASE_PATH || '',
@ -37,6 +41,7 @@ module.exports = {
...ymlEnv,
},
publicRuntimeConfig: {
...urls,
nodeEnv: process.env.NODE_ENV || 'development',
apiUrl: `${process.env.BASE_PATH || ''}/api/v1`,
apiBaseUrl: `${process.env.API_BASE_URL || ''}/api/v1`,

View file

@ -58,7 +58,7 @@ describe('Bitcoin Resolvers', () => {
expect(res.errors).toBe(undefined);
expect(fetchMock).toBeCalledWith(
'https://mempool.space/api/v1/fees/recommended',
'undefined/api/v1/fees/recommended',
undefined
);
expect(res).toMatchSnapshot();

View file

@ -1,3 +1,8 @@
import getConfig from 'next/config';
const { publicRuntimeConfig } = getConfig() || {};
const { mempoolUrl } = publicRuntimeConfig || {};
const tbase =
process.env.NODE_ENV === 'development'
? 'http://localhost:3010/dev/v1'
@ -12,9 +17,9 @@ export const appUrls = {
tbase,
amboss,
oneml: 'https://amboss.space/node/',
blockchain: 'https://mempool.space/tx/',
blockchainAddress: 'https://mempool.space/address/',
fees: 'https://mempool.space/api/v1/fees/recommended',
blockchain: `${mempoolUrl}/tx/`,
blockchainAddress: `${mempoolUrl}/address/`,
fees: `${mempoolUrl}/api/v1/fees/recommended`,
ticker: 'https://blockchain.info/ticker',
github: 'https://api.github.com/repos/apotdevin/thunderhub/releases/latest',
update: 'https://github.com/apotdevin/thunderhub#updating',