Skip to content

Commit

Permalink
- Remove the environment variables from the netlify.toml in favor of …
Browse files Browse the repository at this point in the history
…create-react-app env configuration

- Remove the polling interval override in the index.tsx which is redundant with the connectors file overrides
  • Loading branch information
moodysalem committed May 20, 2020
1 parent 206e845 commit a10b22a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 24 deletions.
5 changes: 1 addition & 4 deletions .env
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
REACT_APP_CHAIN_ID="1"
REACT_APP_NETWORK_URL="https://mainnet.infura.io/v3/b8800ce81b8c451698081d269b86692b"
REACT_APP_PORTIS_ID=""
REACT_APP_FORTMATIC_KEY=""
REACT_APP_GOOGLE_ANALYTICS_ID="UA-128182339-4"
REACT_APP_NETWORK_URL="https://mainnet.infura.io/v3/b8800ce81b8c451698081d269b86692b"
5 changes: 5 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
REACT_APP_CHAIN_ID="1"
REACT_APP_NETWORK_URL="https://mainnet.infura.io/v3/2acb2baa4c06402792e0c701a3697d10"
REACT_APP_PORTIS_ID="c0e2bf01-4b08-4fd5-ac7b-8e26b58cd236"
REACT_APP_FORTMATIC_KEY="pk_live_F937DF033A1666BF"
REACT_APP_GOOGLE_ANALYTICS_ID="UA-128182339-4"
9 changes: 0 additions & 9 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,3 @@
from = "/*"
to = "/index.html"
status = 200

[build.environment]
REACT_APP_NETWORK_URL = "https://mainnet.infura.io/v3/b8800ce81b8c451698081d269b86692b"

[context.production.environment]
REACT_APP_CHAIN_ID = "1"
REACT_APP_NETWORK_URL = "https://mainnet.infura.io/v3/2acb2baa4c06402792e0c701a3697d10"
REACT_APP_FORTMATIC_KEY = "pk_live_F937DF033A1666BF"
REACT_APP_PORTIS_ID = "c0e2bf01-4b08-4fd5-ac7b-8e26b58cd236"
21 changes: 10 additions & 11 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
import { Web3Provider } from '@ethersproject/providers'
import { createWeb3ReactRoot, Web3ReactProvider } from '@web3-react/core'
import React from 'react'
import { isMobile } from 'react-device-detect'
import ReactDOM from 'react-dom'
import ReactGA from 'react-ga'
import { Web3ReactProvider, createWeb3ReactRoot } from '@web3-react/core'
import { Web3Provider } from '@ethersproject/providers'
import { Provider } from 'react-redux'

import { NetworkContextName } from './constants'
import { isMobile } from 'react-device-detect'
import WalletUpdater from './state/wallet/updater'
import './i18n'
import App from './pages/App'
import store from './state'
import ApplicationUpdater from './state/application/updater'
import TransactionUpdater from './state/transactions/updater'
import UserUpdater from './state/user/updater'
import WalletUpdater from './state/wallet/updater'
import ThemeProvider, { FixedGlobalStyle, ThemedGlobalStyle } from './theme'
import './i18n'

const Web3ProviderNetwork = createWeb3ReactRoot(NetworkContextName)

function getLibrary(provider): Web3Provider {
const library = new Web3Provider(provider)
library.pollingInterval = 10000
return library
function getLibrary(provider: any): Web3Provider {
return new Web3Provider(provider)
}

if (process.env.NODE_ENV === 'production') {
ReactGA.initialize(process.env.REACT_APP_GOOGLE_ANALYTICS_ID)
const GOOGLE_ANALYTICS_ID: string | undefined = process.env.REACT_APP_GOOGLE_ANALYTICS_ID
if (typeof GOOGLE_ANALYTICS_ID === 'string') {
ReactGA.initialize(GOOGLE_ANALYTICS_ID)
ReactGA.set({
customBrowserType: !isMobile ? 'desktop' : 'web3' in window || 'ethereum' in window ? 'mobileWeb3' : 'mobileRegular'
})
Expand Down

0 comments on commit a10b22a

Please sign in to comment.