mirror of
https://github.com/sergeyyarkov/educt-client.git
synced 2026-10-11 10:19:22 +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 ./
|
COPY package*.json ./
|
||||||
RUN npm install
|
RUN npm install
|
||||||
COPY . .
|
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
|
RUN npm run build
|
||||||
|
|
||||||
FROM ${NGINX_IMAGE} as production
|
FROM ${NGINX_IMAGE} as production
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { AxiosRequestConfig } from 'axios';
|
|||||||
import * as constants from '@educt/constants';
|
import * as constants from '@educt/constants';
|
||||||
|
|
||||||
const apiConfig: AxiosRequestConfig = {
|
const apiConfig: AxiosRequestConfig = {
|
||||||
baseURL: `${constants.BACKEND_URL}/api/`,
|
baseURL: `${constants.BACKEND_URL}/`,
|
||||||
responseType: 'json',
|
responseType: 'json',
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -84,7 +84,7 @@ const LessonForm: React.FC<LessonFormPropsType> = ({
|
|||||||
<VideoUploader
|
<VideoUploader
|
||||||
onChange={file => onChange(file)}
|
onChange={file => onChange(file)}
|
||||||
file={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 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 {
|
interface ImportMetaEnv {
|
||||||
readonly VITE_API_URL?: string | undefined;
|
readonly VITE_API_URL?: string | undefined;
|
||||||
|
readonly VITE_WS_URL?: string | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user