Skip to content

Commit

Permalink
feat: enhance WebSocket configuration in API route
Browse files Browse the repository at this point in the history
- Integrated sidebar configuration retrieval to improve WebSocket URL management.
- Updated the GET method to prioritize the sidebar config's wsUrl, falling back to the environment variable if necessary.
- Set the runtime to 'edge' for optimized performance.
  • Loading branch information
kiritoko1029 committed Dec 29, 2024
1 parent af37dde commit 83860fb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/api/ws-config/route.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { NextResponse } from "next/server";
import { getSidebarConfig } from "../../config/server";

const config = getSidebarConfig();

export async function GET() {
return NextResponse.json({
wsUrl: process.env.WS_URL ?? "",
wsUrl: config.wsUrl || process.env.WS_URL || "",
});
}

export const runtime = "edge";

0 comments on commit 83860fb

Please sign in to comment.