Skip to content

Commit 1194a78

Browse files
committed
Add config file
1 parent 38af111 commit 1194a78

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/config.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// env: local || development || production
2+
3+
const local = {
4+
graphUrl: 'http://localhost:8888/.netlify/functions/graphql',
5+
env: 'local',
6+
};
7+
8+
const config = {
9+
graphUrl: process.env.REACT_APP_GRAPH_URL || local.graphUrl,
10+
env: process.env.REACT_APP_ENV || local.env,
11+
};
12+
13+
export default config;

src/router.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { BrowserRouter as Router, Switch, Route } from "react-router-dom";
33
import HomeContainer from "./containers/home";
44
import ApolloClient from "apollo-boost";
55
import { ApolloProvider } from "@apollo/react-hooks";
6+
import config from './config'
67

7-
// TODO: Move uri value to config file
88
const client = new ApolloClient({
9-
uri: "https://hardcore-haibt-da9a6b.netlify.com/.netlify/functions/graphql"
9+
uri: config.graphUrl
1010
});
1111

1212
const Routes = () => {

0 commit comments

Comments
 (0)