File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change 11import * as React from 'react'
2+ import { DEBUG } from '../../environment'
23import Debugger from './index'
34import stateToString from './stateToString'
45
5- const SHOW_DEBUGGER = JSON . parse ( process . env . REACT_APP_DEBUG || 'false' )
6-
76const debuggerWrapper = ( element : React . ReactElement , state : any ) => {
8- if ( SHOW_DEBUGGER ) {
7+ if ( DEBUG ) {
98 return (
109 < Debugger state = { stateToString ( state . value ) } { ...state . context } >
1110 { element }
Original file line number Diff line number Diff line change 1+ interface Environment {
2+ GQL_URI : string
3+ DEBUG : boolean
4+ }
5+
6+ // validate .env
7+ const requiredKeys = [ 'REACT_APP_GQL_URI' ]
8+ for ( const required of requiredKeys ) {
9+ if ( ! process . env [ required ] ) {
10+ throw new Error ( `Missing Environmental Variables: ${ required } ` )
11+ }
12+ }
13+
14+ export const GQL_URI = process . env . REACT_APP_GQL_URI || ''
15+ export const DEBUG = ( process . env . REACT_APP_DEBUG || '' ) . toLowerCase ( ) === 'true'
Original file line number Diff line number Diff line change 11import ApolloClient , { InMemoryCache } from 'apollo-boost'
2+ import { GQL_URI } from '../../environment'
23import { authorizeHeaders } from './auth'
34
45export const cache = new InMemoryCache ( )
56
67const client = new ApolloClient ( {
7- uri : process . env . REACT_APP_GQL_URI ,
8+ uri : GQL_URI ,
89 request : authorizeHeaders ,
910 cache,
1011} )
You can’t perform that action at this time.
0 commit comments