Skip to content

Commit 35e23a7

Browse files
committed
- changed: injection of fiware server url with environment variable
1 parent 61e6d91 commit 35e23a7

File tree

5 files changed

+30
-12
lines changed

5 files changed

+30
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
# misc
1717
.DS_Store
18+
.env
1819
.env.local
1920
.env.development.local
2021
.env.test.local

app/services/fiwareService.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import axios, {AxiosInstance} from 'axios';
22

3-
// const baseUrlFiwareServer: string = 'http://46.253.253.122:30003';
43
const baseUrlFiwareServer: string = 'http://localhost:5173';
54
const entitiesApiUrlFiwareServer: string = baseUrlFiwareServer + '/v2/entities/';
65

package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@testing-library/react": "^13.4.0",
1616
"@testing-library/user-event": "^13.5.0",
1717
"axios": "^1.7.9",
18+
"dotenv": "^16.4.7",
1819
"isbot": "^5",
1920
"ol": "^10.2.1",
2021
"react": "^18.3.1",

vite.config.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
import {reactRouter} from '@react-router/dev/vite';
22
import autoprefixer from 'autoprefixer';
3-
import {defineConfig} from 'vite';
3+
import {defineConfig, loadEnv} from 'vite';
44

5-
export default defineConfig({
6-
css: {
7-
postcss: {
8-
plugins: [autoprefixer]
9-
}
10-
},
11-
plugins: [reactRouter()],
12-
server: {
13-
proxy: {
14-
'/v2/entities': 'http://46.253.253.122:30003'
5+
export default defineConfig(({ mode }) => {
6+
const env = loadEnv(mode, process.cwd());
7+
8+
return {
9+
css: {
10+
postcss: {
11+
plugins: [autoprefixer]
12+
}
13+
},
14+
plugins: [reactRouter()],
15+
server: {
16+
proxy: {
17+
'/v2/entities': env.VITE_FIWARE_SERVER_BASE_URL
18+
}
1519
}
1620
}
1721
});

0 commit comments

Comments
 (0)