Skip to content

Commit 4bfeb72

Browse files
committed
Heroku deployment fix
1 parent aebc2f3 commit 4bfeb72

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

src/Components/Views/Home.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Home extends React.Component {
1414
constructor(props) {
1515
super(props);
1616
let username = "akashraj9828";
17-
try {
17+
try {
1818
username = props.match.params.username
1919
? props.match.params.username
2020
: "akashraj9828";

src/config/index.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
// const API_BASE_URL_PROD = "https://gitstats-api-prod.herokuapp.com/";
22
const API_BASE_URL_PROD = "https://api.gitstats.me/";
33
const API_BASE_URL_DEV = "https://gitstats-api-stage.herokuapp.com/";
4-
const API_BASE_URL= process.env.NODE_ENV === 'production' ? API_BASE_URL_PROD : API_BASE_URL_DEV;
5-
const SENTRY_URL="https://f32dcf786d96407dae5c787a38d5b88d@o380288.ingest.sentry.io/5209222";
6-
const GA_CODE="UA-132223767-1"
7-
const NODE_ENV=process.env.NODE_ENV
4+
// default use dev api endpoint
5+
let API_BASE_URL = API_BASE_URL_DEV;
6+
// if production set production api
7+
if (process.env.NODE_ENV === "production") {
8+
API_BASE_URL = API_BASE_URL_PROD
9+
}
10+
11+
// if CUSTOM_API env variable set overwrite all
12+
// for heroku deployments
13+
try {
14+
if(process.env.CUSTOM_API){
15+
API_BASE_URL=process.env.CUSTOM_API
16+
}
17+
} catch (error) {
18+
console.log(error);
19+
}
20+
21+
const SENTRY_URL = "https://f32dcf786d96407dae5c787a38d5b88d@o380288.ingest.sentry.io/5209222";
22+
const GA_CODE = "UA-132223767-1"
23+
const NODE_ENV = process.env.NODE_ENV
824
export default {
925
API_BASE_URL_PROD,
1026
API_BASE_URL_DEV,

0 commit comments

Comments
 (0)