use env variable to distinguish dev and prod

This commit is contained in:
Alexander Bentkamp
2022-10-18 09:37:32 +02:00
parent 866c4b7211
commit b8cea5b0f4
3 changed files with 16 additions and 8 deletions
+11 -4
View File
@@ -14,10 +14,17 @@ const server = app
const wss = new WebSocket.Server({ server })
let cmd = "./build/bin/gameserver";
let cmdArgs = ["TestGame","../testgame"];
// let cmd = "docker";
// let cmdArgs = ["run", "--runtime=runsc", "--network=none", "--rm", "-i", "nng4:latest"];
const environment = process.env.NODE_ENV
const isDevelopment = environment === 'development'
let cmd, cmdArgs;
if (isDevelopment) {
cmd = "./build/bin/gameserver";
cmdArgs = ["TestGame","../testgame"];
} else{
cmd = "docker";
cmdArgs = ["run", "--runtime=runsc", "--network=none", "--rm", "-i", "testgame:latest"];
}
class ClientConnection {