feat: checking env variables

pull/1097/head
smit95tpatel 2022-05-04 19:36:26 +05:30
parent db9e6d6040
commit ce71c9c803
9 changed files with 2092 additions and 2083 deletions

View File

@ -20,8 +20,7 @@ COPY ./react-frontend/yarn.lock .
COPY ./react-frontend/.npmrc . COPY ./react-frontend/.npmrc .
RUN yarn install --pure-lockfile --network-timeout 1000000 RUN yarn install --pure-lockfile --network-timeout 1000000
COPY ./react-frontend/ . COPY ./react-frontend/ .
COPY ./react-frontend/.env.production . RUN yarn build && yarn cache clean
RUN yarn build:production && yarn cache clean
# Statping Golang BACKEND building from source # Statping Golang BACKEND building from source
# Creates "/go/bin/statping" and "/usr/local/bin/sass" for copying # Creates "/go/bin/statping" and "/usr/local/bin/sass" for copying

View File

@ -0,0 +1,2 @@
REACT_APP_LUMBERJACK_API_URL="https://lumberjack.stage.razorpay.in/v1/track"
REACT_APP_LUMBERJACK_API_KEY='10pYUm55sa39zgTN1gzNwQzNyQjM54Cg'

View File

@ -0,0 +1,2 @@
REACT_APP_LUMBERJACK_API_URL="https://lumberjack.razorpay.com/v1/track"
REACT_APP_LUMBERJACK_API_KEY='10pYUm55sa39zgTN1gzNwQzNyQjM54Cg'

View File

@ -3,9 +3,8 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "react-scripts start", "start": "env-cmd -f ./configs/dev.env react-scripts start",
"build": "rm -rf build && GENERATE_SOURCEMAP=false react-scripts build", "build": "env-cmd -f ./configs/prod.env rm -rf build && GENERATE_SOURCEMAP=false react-scripts build",
"build:production": "rm -rf build && GENERATE_SOURCEMAP=false REACT_APP_ENV=production react-scripts build",
"test": "react-scripts test", "test": "react-scripts test",
"eject": "react-scripts eject" "eject": "react-scripts eject"
}, },
@ -22,6 +21,7 @@
"apexcharts": "^3.28.1", "apexcharts": "^3.28.1",
"axios": "^0.21.1", "axios": "^0.21.1",
"date-fns": "^2.23.0", "date-fns": "^2.23.0",
"env-cmd": "^10.1.0",
"framer-motion": "^4", "framer-motion": "^4",
"node-sass": "^6.0.1", "node-sass": "^6.0.1",
"react": "^17.0.2", "react": "^17.0.2",

View File

@ -39,7 +39,5 @@
<script type="text/javaScript"> <script type="text/javaScript">
window.LUMBERJACK_API_URL = "%REACT_APP_LUMBERJACK_API_URL%"; window.LUMBERJACK_API_URL = "%REACT_APP_LUMBERJACK_API_URL%";
window.LUMBERJACK_API_KEY = "%REACT_APP_LUMBERJACK_API_KEY%"; window.LUMBERJACK_API_KEY = "%REACT_APP_LUMBERJACK_API_KEY%";
console.log(window)
</script> </script>
</html> </html>

View File

@ -7,7 +7,7 @@ import Navigation from "./Navbar";
import { initLumberjack } from "../utils/trackers"; import { initLumberjack } from "../utils/trackers";
const App = () => { const App = () => {
console.log(`Application running on ${JSON.stringify(process.env)} mode.`); console.log(`Application running on ${process.env.NODE_ENV} mode.`);
useEffect(() => { useEffect(() => {
initLumberjack(); initLumberjack();
}, []) }, [])

View File

@ -4,7 +4,7 @@ import { titleCase } from './helper';
export const sendToLumberjack = ({ eventName, properties = {} }) => { export const sendToLumberjack = ({ eventName, properties = {} }) => {
const body = { const body = {
mode: 'live', mode: 'live',
key: '10pYUm55sa39zgTN1gzNwQzNyQjM54Cg', key: window.LUMBERJACK_API_KEY,
events: [ events: [
{ {
event_type: 'website', event_type: 'website',
@ -18,7 +18,7 @@ export const sendToLumberjack = ({ eventName, properties = {} }) => {
], ],
}; };
fetch('https://lumberjack.stage.razorpay.in/v1/track', { fetch(window.LUMBERJACK_API_URL, {
method: 'post', method: 'post',
body: JSON.stringify(body), body: JSON.stringify(body),
headers: { headers: {

View File

@ -3,7 +3,7 @@ import analyticsService from '@razorpay/universe-utils/analytics';
export const initLumberjack = () => { export const initLumberjack = () => {
analyticsService.init({ analyticsService.init({
lumberjackAppName: 'website', lumberjackAppName: 'website',
lumberjackApiKey: '10pYUm55sa39zgTN1gzNwQzNyQjM54Cg', lumberjackApiKey: window.LUMBERJACK_API_KEY,
lumberjackApiUrl: "https://lumberjack.stage.razorpay.in/v1/track", lumberjackApiUrl: window.LUMBERJACK_API_URL,
}); });
}; };

File diff suppressed because it is too large Load Diff