Skip to content

Commit

Permalink
Fix ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriy committed Oct 13, 2020
1 parent 102f639 commit adeb5d9
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions .env.mainnet
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ ETH_EXPLORER_URL=https://etherscan.io
HMY_EXPLORER_URL=https://explorer.harmony.one/#

THRESHOLD=2

GET_TOKENS_SERVICE=false
2 changes: 2 additions & 0 deletions .env.testnet
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 3 additions & 4 deletions config/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export const App: React.FC = () => (
<React.Suspense fallback={<div />}>
<Switch>
<Route exact path="/get-tokens" component={MintTokens} />
<Route exact path="/tokens" component={Tokens} />
{process.env.GET_TOKENS_SERVICE === 'true' ? (
<Route exact path="/tokens" component={Tokens} />
) : null}
<Route exact path="/explorer" component={Explorer} />
<Route exact path="/:token" component={EthBridge} />
<Route
Expand Down
30 changes: 15 additions & 15 deletions src/components/Head/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ const MainLogo = styled.img`
height: 32px;
`;

const getTokenServiceEnable = process.env.GET_TOKENS_SERVICE === 'true';

export const Head: React.FC<IStyledChildrenProps<BoxProps>> = withTheme(
observer(({ theme, ...props }: IStyledChildrenProps<BoxProps>) => {
const history = useHistory();
Expand Down Expand Up @@ -82,21 +84,19 @@ export const Head: React.FC<IStyledChildrenProps<BoxProps>> = withTheme(
</Box>

<Box direction="row" align="center" gap="15px">
{/*<Box>*/}
{/* <Text>Select token</Text>*/}
{/*</Box>*/}

<Box
className={cn(
styles.itemToken,
isGetTokens ? styles.selected : '',
)}
onClick={() => {
routing.push(`/get-tokens`);
}}
>
<Text>Get tokens</Text>
</Box>
{getTokenServiceEnable ? (
<Box
className={cn(
styles.itemToken,
isGetTokens ? styles.selected : '',
)}
onClick={() => {
routing.push(`/get-tokens`);
}}
>
<Text>Get tokens</Text>
</Box>
) : null}

<Box
className={cn(
Expand Down

0 comments on commit adeb5d9

Please sign in to comment.