fea(frontend): add WS_SERVER_ADDRESS env

This commit is contained in:
Halit Aksoy 2024-12-08 22:47:02 +03:00
parent c916eef54e
commit 9dedc31626
2 changed files with 11 additions and 4 deletions

View File

@ -19,3 +19,9 @@ yarn dev
### Development Dependencies
This package depends on the local packages `@mancala/core` and `mancala.js`. Refer to their documentation for further instructions.
### Docker Build
```bash
docker build --build-arg SERVER_ADDRESS=http://localhost:5000 --build-arg WS_SERVER_ADDRESS=http://localhost:5000 -t mancala-frontend .
```

View File

@ -5,13 +5,14 @@ export type Server = {
wsServerAdress: string;
};
export const LOCAL_PORT='localhost:5005';
export const LOCAL_SERVER_ADDRESS='http://localhost:5005';
export const LOCAL_WS_SERVER_ADDRESS='http://localhost:5005';
export const server: Server = {
//@ts-ignore
serverAdress: process.env.SERVER_ADDRESS ? `https://${process.env.SERVER_ADDRESS}` : 'http://' + LOCAL_PORT,
serverAdress: process.env.SERVER_ADDRESS ? `${process.env.SERVER_ADDRESS}` : LOCAL_PORT,
//@ts-ignore
wsServerAdress: process.env.SERVER_ADDRESS ? `wss://${process.env.SERVER_ADDRESS}` : 'ws://' + LOCAL_PORT,
wsServerAdress: process.env.WS_SERVER_ADDRESS ? `${process.env.WS_SERVER_ADDRESS}` : LOCAL_WS_SERVER_ADDRESS,
}
export const RTMT_WS_PING_INTERVAL = 1000, RTMT_WS_PING_INTERVAL_BUFFER_TIME = 2000;