Skip to content

Commit

Permalink
chore: custom mempool url
Browse files Browse the repository at this point in the history
  • Loading branch information
apotdevin committed Sep 28, 2021
1 parent bc09166 commit dbf2da3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
# LOG_LEVEL='info'
# TOR_PROXY_SERVER=socks://127.0.0.1:9050

# -----------
# URLs
# -----------
# MEMPOOL_URL='https://mempool.space'

# -----------
# Interface Configs
# -----------
Expand Down
5 changes: 5 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '',
Expand All @@ -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`,
Expand Down
2 changes: 1 addition & 1 deletion server/schema/bitcoin/bitcoin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
11 changes: 8 additions & 3 deletions server/utils/appUrls.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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',
Expand Down

0 comments on commit dbf2da3

Please sign in to comment.