mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-17 07:16:09 +00:00
Add .env.example
to React app
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -23,3 +23,6 @@ build
|
||||
|
||||
# Ignore the scripts that are created for development
|
||||
*dev.*
|
||||
|
||||
# Environment variables
|
||||
.env
|
||||
|
@@ -3,6 +3,7 @@ FROM node:14-slim AS site-build
|
||||
WORKDIR /app/ui-build
|
||||
|
||||
COPY ui .
|
||||
RUN rm .env
|
||||
RUN npm i
|
||||
RUN npm run build
|
||||
|
||||
|
2
ui/.env.example
Normal file
2
ui/.env.example
Normal file
@@ -0,0 +1,2 @@
|
||||
REACT_APP_OVERRIDE_WS_URL="ws://localhost:8899/ws"
|
||||
REACT_APP_OVERRIDE_API_URL="http://localhost:8899/api/"
|
@@ -2,17 +2,15 @@ import * as axios from "axios";
|
||||
|
||||
const mizuAPIPathPrefix = "/mizu";
|
||||
|
||||
// When working locally (with npm run start) change to:
|
||||
// export const MizuWebsocketURL = `ws://localhost:8899${mizuAPIPathPrefix}/ws`;
|
||||
export const MizuWebsocketURL = `ws://${window.location.host}${mizuAPIPathPrefix}/ws`;
|
||||
// When working locally cp `cp .env.example .env`
|
||||
export const MizuWebsocketURL = process.env.REACT_APP_OVERRIDE_WS_URL ? process.env.REACT_APP_OVERRIDE_WS_URL : `ws://${window.location.host}${mizuAPIPathPrefix}/ws`;
|
||||
|
||||
export default class Api {
|
||||
|
||||
constructor() {
|
||||
|
||||
// When working locally (with npm run start) change to:
|
||||
// const apiURL = `http://localhost:8899/${mizuAPIPathPrefix}/api/`;
|
||||
const apiURL = `${window.location.origin}${mizuAPIPathPrefix}/api/`;
|
||||
// When working locally cp `cp .env.example .env`
|
||||
const apiURL = process.env.REACT_APP_OVERRIDE_API_URL ? process.env.REACT_APP_OVERRIDE_API_URL : `${window.location.origin}${mizuAPIPathPrefix}/api/`;
|
||||
|
||||
this.client = axios.create({
|
||||
baseURL: apiURL,
|
||||
|
Reference in New Issue
Block a user