Skip to content

Commit

Permalink
ci(client): pass env variable to react app in the right way
Browse files Browse the repository at this point in the history
  • Loading branch information
yossi-eynav committed Feb 11, 2024
1 parent 415c6be commit 7f0d638
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions client/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
REACT_APP_MAPBOX_KEY=pk.eyJ1IjoibWVpcmltIiwiYSI6ImNrbWNjYmlwYjJhYzYycW42NTYzcmdpYWcifQ.lCBjl1gWMI6UxySOCCBUHg
REACT_APP_BASE_API_URL=https://staging-api.meirim.org/api
1 change: 1 addition & 0 deletions client/.env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
REACT_APP_BASE_API_URL=https://api.meirim.org/api
2 changes: 1 addition & 1 deletion client/src/components/Map/map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Mapbox from 'react-map-gl';
import PropTypes from 'prop-types';

mapboxgl.workerClass = MapboxWorker;
const apiKey = process.env.CONFIG.mapboxApiKey;
const apiKey = process.env.REACT_APP_MAPBOX_KEY;


export const Map = ({ onMouseMove, id, children, onClick, initialViewState, interactiveLayerIds, style, mapStyle = 'mapbox://styles/mapbox/light-v11' }) => {
Expand Down
5 changes: 4 additions & 1 deletion client/src/services/api.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import axios from 'axios'

const instance = axios.create(process.env.CONFIG.axios)
const instance = axios.create({
"baseURL": process.env.REACT_APP_BASE_API_URL,
"withCredentials": true
})

export default {
get: (path, data, options) => instance.get(path, { params: data }, options)
Expand Down
4 changes: 2 additions & 2 deletions client/src/services/paymentApi.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const axios = require('axios');
const config = process.env.CONFIG.axios;
const config = process.env.REACT_APP_BASE_API_URL

const instance = axios.create({
baseURL: `${config.baseURL}/funding`
baseURL: `${config}/funding`
})

module.exports = {
Expand Down

0 comments on commit 7f0d638

Please sign in to comment.