diff --git a/ui/.env.dev.basic b/ui/.env.dev.basic new file mode 100644 index 000000000..94b65687c --- /dev/null +++ b/ui/.env.dev.basic @@ -0,0 +1,3 @@ +REACT_APP_OVERRIDE_WS_URL="ws://localhost:8899/ws" +REACT_APP_OVERRIDE_API_URL="http://localhost:8899/" +REACT_APP_OVERRIDE_IS_ENTERPRISE="false" diff --git a/ui/.env.dev.enterprise b/ui/.env.dev.enterprise new file mode 100644 index 000000000..4a7c3e4e6 --- /dev/null +++ b/ui/.env.dev.enterprise @@ -0,0 +1,3 @@ +REACT_APP_OVERRIDE_WS_URL="ws://localhost:8899/ws" +REACT_APP_OVERRIDE_API_URL="http://localhost:8899/" +REACT_APP_OVERRIDE_IS_ENTERPRISE="true" diff --git a/ui/package.json b/ui/package.json index 06baecb42..345270d15 100644 --- a/ui/package.json +++ b/ui/package.json @@ -49,7 +49,8 @@ }, "scripts": { "start": "craco start", - "start-ent": "./node_modules/.bin/env-cmd -f .env.enterprise craco start", + "start-dev": "./node_modules/.bin/env-cmd -f .env.dev.basic craco start", + "start-dev-ent": "./node_modules/.bin/env-cmd -f .env.dev.enterprise craco start", "build": "./node_modules/.bin/env-cmd -f .env.basic craco build", "build-ent": "BUILD_PATH='./build-ent' ./node_modules/.bin/env-cmd -f .env.enterprise craco build", "test": "craco test", diff --git a/ui/src/helpers/api.js b/ui/src/helpers/api.js index 455d72861..65ddc2b46 100644 --- a/ui/src/helpers/api.js +++ b/ui/src/helpers/api.js @@ -1,12 +1,13 @@ import * as axios from "axios"; -export const MizuWebsocketURL = window.location.protocol === 'https:' ? `wss://${window.location.host}/ws` : `ws://${window.location.host}/ws`; +export const MizuWebsocketURL = process.env.REACT_APP_OVERRIDE_WS_URL ? process.env.REACT_APP_OVERRIDE_WS_URL : + window.location.protocol === 'https:' ? `wss://${window.location.host}/ws` : `ws://${window.location.host}/ws`; export const FormValidationErrorType = "formError"; const CancelToken = axios.CancelToken; -const apiURL =`${window.location.origin}/`; +const apiURL = process.env.REACT_APP_OVERRIDE_API_URL ? process.env.REACT_APP_OVERRIDE_API_URL : `${window.location.origin}/`; export default class Api { static instance;