File tree Expand file tree Collapse file tree 5 files changed +22
-8
lines changed
backend/user-service/src/model Expand file tree Collapse file tree 5 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 1
1
import UserModel , { IUser } from "./user-model" ;
2
- import "dotenv/config " ;
2
+ import dotenv from "dotenv" ;
3
3
import { connect } from "mongoose" ;
4
4
5
+ dotenv . config ( ) ;
6
+
5
7
export async function connectToDB ( ) {
6
8
const mongoDBUri : string | undefined =
7
9
process . env . NODE_ENV === "production"
8
10
? process . env . MONGO_CLOUD_URI
9
11
: process . env . MONGO_LOCAL_URI ;
10
12
13
+ console . log ( mongoDBUri ) ;
14
+
11
15
if ( ! mongoDBUri ) {
12
16
throw new Error ( "MongoDB URI is not provided" ) ;
13
17
}
Original file line number Diff line number Diff line change 1
1
import axios from "axios" ;
2
2
3
- const usersUrl = "http://localhost:3001/api" ;
4
- const questionsUrl = "http://localhost:3000/api/questions" ;
5
- const codeExecutionUrl = "http://localhost:3004/api/run" ;
6
- const qnHistoriesUrl = "http://localhost:3006/api/qnhistories" ;
3
+ const usersUrl =
4
+ import . meta. env . VITE_USER_SERVICE_URL ?? "http://localhost:3001/api" ;
5
+ const questionsUrl =
6
+ import . meta. env . VITE_QN_SERVICE_URL ?? "http://localhost:3000/api/questions" ;
7
+ const codeExecutionUrl =
8
+ import . meta. env . VITE_CODE_EXEC_SERVICE_URL ?? "http://localhost:3004/api/run" ;
9
+ const qnHistoriesUrl =
10
+ import . meta. env . VITE_QN_HIST_SERVICE_URL ??
11
+ "http://localhost:3006/api/qnhistories" ;
7
12
8
13
export const questionClient = axios . create ( {
9
14
baseURL : questionsUrl ,
Original file line number Diff line number Diff line change @@ -32,7 +32,8 @@ export type CollabSessionData = {
32
32
awareness : Awareness ;
33
33
} ;
34
34
35
- const COLLAB_SOCKET_URL = "http://localhost:3003" ;
35
+ const COLLAB_SOCKET_URL =
36
+ import . meta. env . VITE_COLLAB_SERVICE_URL ?? "http://localhost:3003" ;
36
37
export const collabSocket = io ( COLLAB_SOCKET_URL , {
37
38
reconnectionAttempts : 3 ,
38
39
autoConnect : false ,
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ export enum CommunicationEvents {
13
13
DISCONNECTED = "disconnected" ,
14
14
}
15
15
16
- const COMMUNICATION_SOCKET_URL = "http://localhost:3005" ;
16
+ const COMMUNICATION_SOCKET_URL =
17
+ import . meta. env . VITE_COMM_SERVICE_URL ?? "http://localhost:3005" ;
17
18
18
19
export const communicationSocket = io ( COMMUNICATION_SOCKET_URL , {
19
20
reconnectionAttempts : 3 ,
Original file line number Diff line number Diff line change 1
1
import { io } from "socket.io-client" ;
2
2
3
- const MATCH_SOCKET_URL = "http://localhost:3002" ;
3
+ const MATCH_SOCKET_URL =
4
+ import . meta. env . VITE_MATCH_SERVICE_URL ?? "http://localhost:3002" ;
5
+
6
+ console . log ( import . meta. env . VITE_MATCH_SERVICE_URL ) ;
4
7
5
8
export const matchSocket = io ( MATCH_SOCKET_URL , {
6
9
reconnectionAttempts : 3 ,
You can’t perform that action at this time.
0 commit comments