mirror of
https://github.com/ragestudio/comty.js.git
synced 2025-06-09 02:24:18 +00:00
43 lines
945 B
JavaScript
Executable File
43 lines
945 B
JavaScript
Executable File
function getCurrentHostname() {
|
|
if (typeof window === "undefined") {
|
|
return "localhost"
|
|
}
|
|
|
|
return window?.location?.hostname ?? "localhost"
|
|
}
|
|
|
|
function getCurrentProtocol() {
|
|
if (typeof window === "undefined") {
|
|
return "http"
|
|
}
|
|
|
|
return window?.location?.protocol ?? "http:"
|
|
}
|
|
|
|
const envOrigins = {
|
|
"development": `${getCurrentProtocol()}//${getCurrentHostname()}:9000`,
|
|
"indev": "https://indev_api.comty.app",
|
|
"production": "https://api.comty.app",
|
|
}
|
|
|
|
export default {
|
|
origin: envOrigins[process.env.NODE_ENV ?? "production"],
|
|
websockets: [
|
|
{
|
|
namespace: "posts",
|
|
path: "/posts",
|
|
},
|
|
{
|
|
namespace: "main",
|
|
path: "/main",
|
|
},
|
|
{
|
|
namespace: "notifications",
|
|
path: "/notifications",
|
|
},
|
|
{
|
|
namespace: "chats",
|
|
path: "/chats",
|
|
}
|
|
]
|
|
} |