Skip to content

Commit

Permalink
[RDO-70] provide way to modify vite.config.js dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
curcher committed Mar 23, 2024
1 parent a87f6f2 commit a55d078
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const config = {
ASSOCIATIONS_EXT: "Associations",
LOGIN_EXT: "login",
// API_DATA: "https://api.osintforukraine.com/Events",
API_DATA: "https://api.osintforukraine.com/Events",
API_DATA: api_url + "Events",
MAPBOX_TOKEN:
"pk.eyJ1IjoiYmVsbGluZ2NhdC1tYXBib3giLCJhIjoiY2tleW0wbWliMDA1cTJ5bzdkbTRraHgwZSJ9.GJQkjPzj8554VhR5SPsfJg",
// MEDIA_EXT: "/api/media",
Expand Down
9 changes: 7 additions & 2 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import { defineConfig } from "vite";
import { defineConfig, loadEnv } from "vite";
import react from "@vitejs/plugin-react";

//https://vitejs.dev/config/#using-environment-variables-in-config
const env = loadEnv('','');
const api_url = JSON.stringify(env.VITE_API_URL);


// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
Expand All @@ -10,7 +15,7 @@ export default defineConfig({
server: {
proxy: {
"/api": {
target: "https://api.osintforukraine.com/",
target: api_url,
changeOrigin: true,
},
}
Expand Down

0 comments on commit a55d078

Please sign in to comment.