Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Fixes env api
Browse files Browse the repository at this point in the history
  • Loading branch information
philiphand committed Feb 25, 2021
1 parent 2fc1427 commit 30300f1
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cloud.dev.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
env: ['CI=true']
args: ['run', 'test']
- name: 'gcr.io/cloud-builders/npm'
env: ['CI=true', 'NODE_ENV=development']
env: ['CI=true', 'REACT_APP_EFFEKT_API_URL=https://dev.data.gieffektivt.no']
args: ['run', 'build']
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'build/*', 'gs://effekt-widget-react-dev/']
2 changes: 1 addition & 1 deletion cloud.prod.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
env: ['CI=true']
args: ['run', 'test']
- name: 'gcr.io/cloud-builders/npm'
env: ['CI=true', 'NODE_ENV=production']
env: ['CI=true', 'REACT_APP_EFFEKT_API_URL=https://data.gieffektivt.no']
args: ['run', 'build']
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'build/*', 'gs://effekt-widget-react-prod/']
2 changes: 1 addition & 1 deletion cloud.stage.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
env: ['CI=true']
args: ['run', 'test']
- name: 'gcr.io/cloud-builders/npm'
env: ['CI=true', 'NODE_ENV=test']
env: ['CI=true', 'REACT_APP_EFFEKT_API_URL=https://stage.data.gieffektivt.no']
args: ['run', 'build']
- name: 'gcr.io/cloud-builders/gsutil'
args: ['-m', 'cp', '-r', 'build/*', 'gs://effekt-widget-react-stage/']
17 changes: 4 additions & 13 deletions src/config/api.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
let apiUrl;

switch (process.env.NODE_ENV) {
case "development":
apiUrl = "https://dev.data.gieffektivt.no";
break;
case "test":
apiUrl = "https://stage.data.gieffektivt.no";
break;
case "production":
apiUrl = "https://data.gieffektivt.no";
break;
default:
apiUrl = "https://dev.data.gieffektivt.no";
break;
if (process.env.REACT_APP_EFFEKT_API_URL) {
apiUrl = process.env.REACT_APP_EFFEKT_API_URL;
} else {
apiUrl = "https://dev.data.gieffektivt.no";
}

export const API_URL = apiUrl;

0 comments on commit 30300f1

Please sign in to comment.