fix .env files
This commit is contained in:
parent
d826f98308
commit
15c312729e
@ -22,8 +22,6 @@ export const SocketProvider = ({ children }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const userInfo = JSON.parse(localStorage.getItem("user"));
|
const userInfo = JSON.parse(localStorage.getItem("user"));
|
||||||
|
|
||||||
console.log(url.replace("game-api", "socket.io"));
|
|
||||||
const newSocket = io(url.replace("/game-api", ""), {
|
const newSocket = io(url.replace("/game-api", ""), {
|
||||||
path: "/socket.io/",
|
path: "/socket.io/",
|
||||||
auth: { token, username: userInfo?.username },
|
auth: { token, username: userInfo?.username },
|
||||||
|
|||||||
@ -8,6 +8,7 @@ const config = {
|
|||||||
serverDescription: process.env.DESCRIPTION,
|
serverDescription: process.env.DESCRIPTION,
|
||||||
serverRegion: process.env.REGION,
|
serverRegion: process.env.REGION,
|
||||||
dbUri: process.env.DB_URI || "local",
|
dbUri: process.env.DB_URI || "local",
|
||||||
|
host: process.env.HOST,
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = config;
|
module.exports = config;
|
||||||
|
|||||||
@ -50,13 +50,15 @@ const registerInApi = async () => {
|
|||||||
try {
|
try {
|
||||||
await axios.post(`${config.apiBaseUrl}/servers/register`, {
|
await axios.post(`${config.apiBaseUrl}/servers/register`, {
|
||||||
name: config.serverName,
|
name: config.serverName,
|
||||||
url: `https://dev-test.galaxystrike.online/game-api`,
|
url: config.host,
|
||||||
secret: config.serverSecret,
|
secret: config.serverSecret,
|
||||||
isModded: false,
|
isModded: false,
|
||||||
description: config.serverDescription,
|
description: config.serverDescription,
|
||||||
region: config.serverRegion,
|
region: config.serverRegion,
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(`Error: API server not found at ${config.apiBaseUrl}`);
|
||||||
|
console.log("Please configure API_SERVER_URL= in your .env file");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -81,7 +83,7 @@ server.listen(config.port, async () => {
|
|||||||
economyService.init(io);
|
economyService.init(io);
|
||||||
await registerInApi();
|
await registerInApi();
|
||||||
setInterval(sendHeartbeat, HEARTBEAT_INTERVAL);
|
setInterval(sendHeartbeat, HEARTBEAT_INTERVAL);
|
||||||
console.log(`🚀 Server running on port ${config.port}`);
|
console.log(`Server running on ${config.host}. PORT: ${config.port}`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
|
|||||||
@ -28,6 +28,7 @@ JWT_SECRET=secret_123
|
|||||||
|
|
||||||
```env
|
```env
|
||||||
PORT=5003
|
PORT=5003
|
||||||
|
HOST=http://localhost:5003
|
||||||
API_SERVER_URL=http://localhost:3000/api
|
API_SERVER_URL=http://localhost:3000/api
|
||||||
SERVER_NAME=Alpha-Centauri-3
|
SERVER_NAME=Alpha-Centauri-3
|
||||||
SERVER_SECRET=game_server_pass_123
|
SERVER_SECRET=game_server_pass_123
|
||||||
|
|||||||
Reference in New Issue
Block a user