diff --git a/Makefile b/Makefile index 3ed5b947..39f84f15 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,15 @@ develop: build: rm -rf build - npm run build + REACT_APP_PRODUCTION=false npm run build + +production-build: + rm -rf build + REACT_APP_PRODUCTION=true npm run build .PHONY: build -stage: build +stage: production-build rsync -zavP build/ -e 'ssh -p 666' ott-staging@staging.instat.tv:/usr/local/www/ott-staging/wwwroot/ a-stage: build diff --git a/src/config/env.tsx b/src/config/env.tsx new file mode 100644 index 00000000..7590618f --- /dev/null +++ b/src/config/env.tsx @@ -0,0 +1 @@ +export const isProduction = process.env.REACT_APP_PRODUCTION === 'true' diff --git a/src/config/routes.tsx b/src/config/routes.tsx index 897c6015..ea2e231e 100644 --- a/src/config/routes.tsx +++ b/src/config/routes.tsx @@ -1,2 +1,4 @@ -export const API_ROOT = 'https://api.instat.tv' +import { isProduction } from './env' + +export const API_ROOT = isProduction ? 'https://api.instat.tv' : 'https://api-staging.instat.tv' export const DATA_URL = `${API_ROOT}/data`