From adeb5d9795666f3ff39595aefc3930a5204da08c Mon Sep 17 00:00:00 2001 From: yuriy Date: Tue, 13 Oct 2020 16:49:02 +0300 Subject: [PATCH] Fix ENV --- .env.development | 2 ++ .env.mainnet | 2 ++ .env.testnet | 2 ++ config/env.js | 7 +++---- src/App.tsx | 4 +++- src/components/Head/index.tsx | 30 +++++++++++++++--------------- 6 files changed, 27 insertions(+), 20 deletions(-) diff --git a/.env.development b/.env.development index 7425320d..499458cb 100644 --- a/.env.development +++ b/.env.development @@ -30,3 +30,5 @@ ETH_EXPLORER_URL=https://kovan.etherscan.io HMY_EXPLORER_URL=https://explorer.testnet.harmony.one/# THRESHOLD=2 + +GET_TOKENS_SERVICE=true diff --git a/.env.mainnet b/.env.mainnet index 2225ffc8..ede8f0fb 100644 --- a/.env.mainnet +++ b/.env.mainnet @@ -31,3 +31,5 @@ ETH_EXPLORER_URL=https://etherscan.io HMY_EXPLORER_URL=https://explorer.harmony.one/# THRESHOLD=2 + +GET_TOKENS_SERVICE=false diff --git a/.env.testnet b/.env.testnet index 0ee31519..dedf6631 100644 --- a/.env.testnet +++ b/.env.testnet @@ -31,3 +31,5 @@ ETH_EXPLORER_URL=https://kovan.etherscan.io HMY_EXPLORER_URL=https://explorer.testnet.harmony.one/# THRESHOLD=2 + +GET_TOKENS_SERVICE=true diff --git a/config/env.js b/config/env.js index a71ada7b..15bebf16 100644 --- a/config/env.js +++ b/config/env.js @@ -5,11 +5,9 @@ const paths = require('./paths'); // Make sure that including paths.js after env.js will read .env variables. delete require.cache[require.resolve('./paths')]; -const { NODE_ENV = "mainnet" } = process.env; +const { NODE_ENV = 'mainnet' } = process.env; -const dotenvFiles = [ - `${paths.dotenv}.${NODE_ENV}`, -].filter(Boolean); +const dotenvFiles = [`${paths.dotenv}.${NODE_ENV}`].filter(Boolean); console.log('dotenvFiles', dotenvFiles); dotenvFiles.forEach(dotenvFile => { @@ -97,6 +95,7 @@ function getClientEnvironment(publicUrl) { BACKEND_URL: process.env.BACKEND_URL, THRESHOLD: process.env.THRESHOLD, + GET_TOKENS_SERVICE: process.env.GET_TOKENS_SERVICE, }, ); // Stringify all values so we can feed into Webpack DefinePlugin diff --git a/src/App.tsx b/src/App.tsx index e3f5868a..08dc6430 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -15,7 +15,9 @@ export const App: React.FC = () => ( }> - + {process.env.GET_TOKENS_SERVICE === 'true' ? ( + + ) : null} > = withTheme( observer(({ theme, ...props }: IStyledChildrenProps) => { const history = useHistory(); @@ -82,21 +84,19 @@ export const Head: React.FC> = withTheme( - {/**/} - {/* Select token*/} - {/**/} - - { - routing.push(`/get-tokens`); - }} - > - Get tokens - + {getTokenServiceEnable ? ( + { + routing.push(`/get-tokens`); + }} + > + Get tokens + + ) : null}