mirror of
https://github.com/sergeyyarkov/educt-client.git
synced 2026-10-11 02:09:08 +03:00
upd: added env for api & websocket urls
This commit is contained in:
parent
3cd2d0eeba
commit
d366c05d55
@ -6,6 +6,11 @@ WORKDIR /home/app
|
||||
COPY package*.json ./
|
||||
RUN npm install
|
||||
COPY . .
|
||||
# Get build arguments and set env variables
|
||||
ARG API_URL
|
||||
ARG WS_URL
|
||||
ENV VITE_API_URL=${API_URL}
|
||||
ENV VITE_WS_URL=${WS_URL}
|
||||
RUN npm run build
|
||||
|
||||
FROM ${NGINX_IMAGE} as production
|
||||
|
||||
@ -2,7 +2,7 @@ import { AxiosRequestConfig } from 'axios';
|
||||
import * as constants from '@educt/constants';
|
||||
|
||||
const apiConfig: AxiosRequestConfig = {
|
||||
baseURL: `${constants.BACKEND_URL}/api/`,
|
||||
baseURL: `${constants.BACKEND_URL}/`,
|
||||
responseType: 'json',
|
||||
withCredentials: true,
|
||||
};
|
||||
|
||||
@ -84,7 +84,7 @@ const LessonForm: React.FC<LessonFormPropsType> = ({
|
||||
<VideoUploader
|
||||
onChange={file => onChange(file)}
|
||||
file={file}
|
||||
preloadedVideoUrl={constants.BACKEND_URL + preloadedVideo?.url}
|
||||
preloadedVideoUrl={preloadedVideo && constants.BACKEND_URL + preloadedVideo.url}
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
export const BACKEND_URL = import.meta.env.VITE_API_URL || 'http://localhost:3333';
|
||||
export const WS_URL = 'ws://localhost:3333';
|
||||
export const WS_URL = import.meta.env.VITE_WS_URL || 'ws://localhost:3333';
|
||||
|
||||
1
src/env.d.ts
vendored
1
src/env.d.ts
vendored
@ -2,6 +2,7 @@
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_API_URL?: string | undefined;
|
||||
readonly VITE_WS_URL?: string | undefined;
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user