From 894a46170ce5184dd7a962b5e5611ce37e561c0f Mon Sep 17 00:00:00 2001 From: aloxe Date: Wed, 29 May 2024 00:56:47 +0200 Subject: [PATCH] Set dev and prod env (#10) * add env vars in repo * test with new repo --- .env.development | 6 ++++++ .env.production | 6 ++++++ .github/workflows/build_test.yml | 2 +- src/helpers/gpxUtil.js | 6 ++---- src/routes/App.jsx | 1 - 5 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 .env.development create mode 100644 .env.production diff --git a/.env.development b/.env.development new file mode 100644 index 0000000..036a742 --- /dev/null +++ b/.env.development @@ -0,0 +1,6 @@ +# tokens +VITE_MAPBOX_TOKEN='pk.eyJ1IjoiYWxveGUiLCJhIjoid3lBT0poSSJ9.QvBnfWvRrXcHGUQPccVtKA' +VITE_THUNDERFOREST_TOKEN='c49b6e87f82046eda9501fa5f09a2e3a' + +# base url +VITE_BASE_URL='/' \ No newline at end of file diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..3c6842b --- /dev/null +++ b/.env.production @@ -0,0 +1,6 @@ +# tokens +VITE_MAPBOX_TOKEN='pk.eyJ1IjoiYWxveGUiLCJhIjoid3lBT0poSSJ9.QvBnfWvRrXcHGUQPccVtKA' +VITE_THUNDERFOREST_TOKEN='c49b6e87f82046eda9501fa5f09a2e3a' + +# base url +VITE_BASE_URL='/velo/traces/' \ No newline at end of file diff --git a/.github/workflows/build_test.yml b/.github/workflows/build_test.yml index 0328c40..330c296 100644 --- a/.github/workflows/build_test.yml +++ b/.github/workflows/build_test.yml @@ -33,7 +33,7 @@ jobs: - name: Install dependencies & yarn build run: | yarn install --frozen-lockfile - yarn build + yarn build --mode development - name: Copy Site recursively to remote uses: appleboy/scp-action@master diff --git a/src/helpers/gpxUtil.js b/src/helpers/gpxUtil.js index 59cada3..0b3ae56 100644 --- a/src/helpers/gpxUtil.js +++ b/src/helpers/gpxUtil.js @@ -3,8 +3,7 @@ import axios from 'axios'; export const getGpxList = async () => { try { - // const response = await axios.get('/api/velotraces/tracks.php'); - const response = await axios.get('https://alix.guillard.fr/velotraces/tracks.php'); + const response = await axios.get('https://alix.guillard.fr/data/velo/tracks.php'); return response.data } catch (error) { console.error('oups Error fetching data:', error.message); @@ -31,8 +30,7 @@ export const filterGpxList = (currentYear, currentCountry, allGpxList) => { export const loadGeoJson = async (url) => { try { - // const response = await axios.get('/api/velotraces/allvelotracks/'+url); - const response = await axios.get('https://alix.guillard.fr/velotraces/allvelotracks/'+url); + const response = await axios.get('https://alix.guillard.fr/data/velo/gpx/'+url); const xmlDom = new DOMParser().parseFromString(response.data, 'application/xml'); const geojson = gpx(xmlDom) diff --git a/src/routes/App.jsx b/src/routes/App.jsx index 06a6cf1..f358c63 100644 --- a/src/routes/App.jsx +++ b/src/routes/App.jsx @@ -7,7 +7,6 @@ import './App.css' function App() { return (
-
{`mode: ${import.meta.env.MODE} image: ${import.meta.env.VITE_BASE_URL}`}
)