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 .
RUN yarn install --pure-lockfile --network-timeout 1000000
COPY ./react-frontend/ .
COPY ./react-frontend/.env.production .
RUN yarn build:production && yarn cache clean
RUN yarn build && yarn cache clean
# Statping Golang BACKEND building from source
# 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",
"private": true,
"scripts": {
"start": "react-scripts start",
"build": "rm -rf build && GENERATE_SOURCEMAP=false react-scripts build",
"build:production": "rm -rf build && GENERATE_SOURCEMAP=false REACT_APP_ENV=production react-scripts build",
"start": "env-cmd -f ./configs/dev.env react-scripts start",
"build": "env-cmd -f ./configs/prod.env rm -rf build && GENERATE_SOURCEMAP=false react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
@ -22,6 +21,7 @@
"apexcharts": "^3.28.1",
"axios": "^0.21.1",
"date-fns": "^2.23.0",
"env-cmd": "^10.1.0",
"framer-motion": "^4",
"node-sass": "^6.0.1",
"react": "^17.0.2",

View File

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

View File

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

View File

@ -4,7 +4,7 @@ import { titleCase } from './helper';
export const sendToLumberjack = ({ eventName, properties = {} }) => {
const body = {
mode: 'live',
key: '10pYUm55sa39zgTN1gzNwQzNyQjM54Cg',
key: window.LUMBERJACK_API_KEY,
events: [
{
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',
body: JSON.stringify(body),
headers: {

View File

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

File diff suppressed because it is too large Load Diff