Fix bug with no random + prevent user from starting game + ENV vars

This commit is contained in:
Lucien Astié 2024-08-12 11:47:59 +02:00
parent f80ff9c60d
commit 1f3b6ec70a
6 changed files with 66 additions and 30 deletions

11
app/[id]/socket.ts Normal file
View file

@ -0,0 +1,11 @@
'use server'
export default async function getSocketUrl() {
const ssl = process.env.USE_SSL == undefined ? false : process.env.USE_SSL
const url = process.env.URL == undefined ? "localhost:3000" : process.env.URL
const protocol = ssl ? "wss://" : "ws://"
console.log(protocol + url)
return protocol + url
}