fix: make dashboard locally accessible only
This commit is contained in:
@@ -6,6 +6,7 @@ const envSchema = z.object({
|
||||
DISCORD_GUILD_ID: z.string().optional(),
|
||||
DATABASE_URL: z.string().min(1, "Database URL is required"),
|
||||
PORT: z.coerce.number().default(3000),
|
||||
HOST: z.string().default("127.0.0.1"),
|
||||
});
|
||||
|
||||
const parsedEnv = envSchema.safeParse(process.env);
|
||||
|
||||
@@ -9,7 +9,8 @@ export class WebServer {
|
||||
|
||||
public static start(port?: number) {
|
||||
this.server = Bun.serve({
|
||||
port: port ?? (typeof env.PORT === "string" ? parseInt(env.PORT) : 3000),
|
||||
port: port ?? env.PORT,
|
||||
hostname: env.HOST,
|
||||
fetch: (req, server) => {
|
||||
const url = new URL(req.url);
|
||||
if (url.pathname === "/ws") {
|
||||
@@ -38,7 +39,7 @@ export class WebServer {
|
||||
},
|
||||
});
|
||||
|
||||
console.log(`🌐 Web server listening on http://localhost:${this.server.port}`);
|
||||
console.log(`🌐 Web server listening on http://${this.server.hostname}:${this.server.port} (Restricted to Local Interface)`);
|
||||
|
||||
// Start a heartbeat loop
|
||||
this.heartbeatInterval = setInterval(() => {
|
||||
|
||||
Reference in New Issue
Block a user