From 8b273171f2965b52e284ccbb063185dd573f2c84 Mon Sep 17 00:00:00 2001 From: dbroqua Date: Tue, 3 Mar 2020 21:34:19 +0100 Subject: [PATCH] Added env file --- .gitignore | 2 ++ README.md | 20 +++++++++++++++++++- package.json | 2 +- src/config.js | 6 +++--- 4 files changed, 25 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 87ccc89..94a2964 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,8 @@ /public/gasStations.xml +.env + # production /build diff --git a/README.md b/README.md index abb97a0..b682365 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,21 @@ Ce projet a simplement pour but de répertorier l'ensemble des stations essences en France. -Les données sont basées sur les [Open Data](https://www.prix-carburants.gouv.fr/rubrique/opendata/). \ No newline at end of file +Les données sont basées sur les [Open Data](https://www.prix-carburants.gouv.fr/rubrique/opendata/). + +# Utilisation + +Une fois le projet cloné vous devrez commencer par créer un fichier `.env` qui contiendra des variables d'environnement : + +``` +REACT_APP_MAPBOX_TOKEN=******** +REACT_APP_API_URL=******** +REACT_APP_MAP_RADIUS=20000 + +``` + +Une fois fait : + +```bash +yarn install +yarn start +``` \ No newline at end of file diff --git a/package.json b/package.json index 91d43e5..64da0bb 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ }, "scripts": { "start": "react-scripts start", - "build": "react-scripts build && ssh porto 'rm -r www/darkou.fr/carburants/static' && scp -r build/* porto:www/darkou.fr/carburants", + "build": "react-scripts build && ssh porto 'rm -r www/darkou.fr/carburants/static www/darkou.fr/carburants/precache-manifest*' && scp -r build/* porto:www/darkou.fr/carburants", "test": "react-scripts test", "lint": "./node_modules/.bin/eslint . --fix", "eject": "react-scripts eject" diff --git a/src/config.js b/src/config.js index b27a553..619aea3 100644 --- a/src/config.js +++ b/src/config.js @@ -24,6 +24,6 @@ export const gasTypes = [ type: "GPLc" } ]; -export const mapboxToken = 'pk.eyJ1IjoiZGFya291IiwiYSI6ImNrNzkwdmlsdTBtMmwzZnM0ZmI4Z3h4czIifQ.GU2CdcMiKiApHNhI0ylGtQ'; -export const baseApiUrl = 'https://api.carburants.darkou.fr/v1/'; -export const radius = 20000; \ No newline at end of file +export const mapboxToken = process.env.REACT_APP_MAPBOX_TOKEN; +export const baseApiUrl = process.env.REACT_APP_API_URL; +export const radius = Number(process.env.REACT_APP_MAP_RADIUS); \ No newline at end of file