File tree 4 files changed +43
-7
lines changed
4 files changed +43
-7
lines changed Original file line number Diff line number Diff line change 1
1
react-app
2
2
---
3
3
4
+ # Local Deployment
5
+ Copy ` envSample ` as ` .env ` .
4
6
Install node dependencies using ` npm install `
5
7
Run the development server using ` npm run start `
6
8
7
- The react app is deployed to heroku ` https://react-app-drones-spanhawk.herokuapp.com `
9
+
10
+ # Local Configuration Variables
11
+ You can edit them in ` .env ` file.
12
+
13
+ # Heroku Deployment
14
+ ```
15
+ git init
16
+ git add .
17
+ git commit -m "react-create-app on Heroku"
18
+ # make sure commit all codes and usuaully you do not need to run above command if you are sure your codes in git repo is latest.
19
+ heroku create -b https://github.com/mars/create-react-app-buildpack.git
20
+ # set variables defined in .env
21
+ heroku config:set REACT_APP_API_BASE_PATH=base url
22
+ heroku config:set REACT_APP_SOCKET_URL=socket url
23
+ heroku config:set REACT_APP_AUTH0_CLIEND_ID=auth0 client id
24
+ heroku config:set REACT_APP_AUTH0_DOMAIN=auth0 domain
25
+ heroku config:set REACT_APP_GOOGLE_API_KEY=google api key
26
+ git push heroku HEAD:master
27
+ heroku open
28
+ ```
29
+
30
+ You can use new configuration with below commands from [ set-vars-on-heroku] ( https://github.com/mars/create-react-app-buildpack#set-vars-on-heroku ) .
31
+ ```
32
+ heroku config:set REACT_APP_API_BASE_PATH=new base url
33
+ git commit --allow-empty -m "Set REACT_APP_API_BASE_PATH config var"
34
+ git push heroku HEAD:master
35
+ ```
Original file line number Diff line number Diff line change
1
+ REACT_APP_API_BASE_PATH=https://kb-dsp-server.herokuapp.com
2
+ REACT_APP_SOCKET_URL=https://kb-dsp-server.herokuapp.com
3
+ REACT_APP_AUTH0_CLIEND_ID=XXXXzjS2nVSqHxHHE64RhvvKY6e0TYpK
4
+ REACT_APP_AUTH0_DOMAIN=dronetest.auth0.com
5
+ REACT_APP_GOOGLE_API_KEY=XXXXSyCR3jfBdv9prCBYBOf-fPUDhjPP4K05YjE
Original file line number Diff line number Diff line change 9
9
* @author TCSCODER
10
10
* @version 1.0.0
11
11
*/
12
-
12
+ import config from './config' ;
13
13
import React , { Component } from 'react' ;
14
14
import './styles/App.css' ;
15
15
import scriptLoader from 'react-async-script-loader' ;
@@ -83,5 +83,5 @@ class App extends Component {
83
83
}
84
84
85
85
export default scriptLoader (
86
- [ ' https://maps.googleapis.com/maps/api/js?key=AIzaSyCR3jfBdv9prCBYBOf-fPUDhjPP4K05YjE' , 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js' ]
86
+ [ ` https://maps.googleapis.com/maps/api/js?key=${ config . google . apiKey } ` , 'https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/markerclusterer.js' ]
87
87
) ( App ) ;
Original file line number Diff line number Diff line change 11
11
12
12
const config = {
13
13
api : {
14
- basePath : 'https://kb-dsp-server.herokuapp.com' ,
14
+ basePath : process . env . REACT_APP_API_BASE_PATH ,
15
15
} ,
16
16
socket : {
17
- url : 'https://kb-dsp-server.herokuapp.com' ,
17
+ url : process . env . REACT_APP_SOCKET_URL ,
18
18
} ,
19
- AUTH0_CLIEND_ID : '3CGKzjS2nVSqHxHHE64RhvvKY6e0TYpK' ,
20
- AUTH0_DOMAIN : 'dronetest.auth0.com' ,
19
+ google : {
20
+ apiKey : process . env . REACT_APP_GOOGLE_API_KEY
21
+ } ,
22
+ AUTH0_CLIEND_ID : process . env . REACT_APP_AUTH0_CLIEND_ID ,
23
+ AUTH0_DOMAIN : process . env . REACT_APP_AUTH0_DOMAIN ,
21
24
} ;
22
25
23
26
export default config ;
You can’t perform that action at this time.
0 commit comments