From 3f2bc8c332730575a0777f89a767b585841702fc Mon Sep 17 00:00:00 2001 From: cfngc4594 Date: Thu, 20 Feb 2025 08:44:11 +0800 Subject: [PATCH] chore: replace hardcoded WebSocket URL with environment variable - Replaced the hardcoded LSP WebSocket URL with a configurable environment variable (NEXT_PUBLIC_LSP_C_URL). - Default to "ws://localhost:4594/clangd" if the environment variable is not set. --- src/components/code-editor.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/code-editor.tsx b/src/components/code-editor.tsx index 3fea4d1..8e784cf 100644 --- a/src/components/code-editor.tsx +++ b/src/components/code-editor.tsx @@ -27,7 +27,8 @@ export default function CodeEditor() { const { resolvedTheme } = useTheme(); useEffect(() => { - const url = normalizeUrl("ws://localhost:4594/clangd"); + const lspUrl = process.env.NEXT_PUBLIC_LSP_C_URL || "ws://localhost:4594/clangd"; + const url = normalizeUrl(lspUrl); const webSocket = new WebSocket(url); webSocket.onopen = async () => {