Skip to content

Commit

Permalink
Use BACKEND_SERVER environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
bleunguts committed Feb 9, 2024
1 parent 929a69e commit 6fbd4b1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
11 changes: 10 additions & 1 deletion Web/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ import { HubConnectionState } from "@microsoft/signalr";
import axios, { AxiosResponse } from 'axios';
import { v1 as uuidv1 } from 'uuid';

const backendServer = `https://projectxgatewayapi-app-20231130.icybay-6c4fad7d.westus2.azurecontainerapps.io`;
const config = () => {
console.log(process.env);
return {
BackendServer : process.env.BACKEND_SERVER
}
}

const backendServer = config().BackendServer ?? `https://projectxgatewayapi-app-20231130.icybay-6c4fad7d.westus2.azurecontainerapps.io`;

//const backendServer = `https://projectxgatewayapi-app-20231130.icybay-6c4fad7d.westus2.azurecontainerapps.io`;
//const backendServer = `https://localhost:8081`;

const connection = new signalR.HubConnectionBuilder()
Expand Down
16 changes: 13 additions & 3 deletions Web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import { defineConfig } from 'vite'
import { defineConfig, loadEnv} from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
export default defineConfig(({ mode }) => {
// Load env file based on `mode` in the current working directory.
// Set the third parameter to '' to load all env regardless of the `VITE_` prefix.
const env = loadEnv(mode, process.cwd(), '')
return {
define: {
'process.env': env
},
plugins: [
react()
],
}
})

0 comments on commit 6fbd4b1

Please sign in to comment.