mirror of
https://github.com/massbug/judge4c.git
synced 2025-05-18 07:16:34 +00:00
feat(language-server): add environment variable support for configuration
This commit is contained in:
parent
470fa306c2
commit
2a47b469b0
@ -4,17 +4,17 @@ import { LanguageServerMetadata } from "@/types/language-server";
|
|||||||
|
|
||||||
const LanguageServerConfig: Record<EditorLanguage, LanguageServerMetadata> = {
|
const LanguageServerConfig: Record<EditorLanguage, LanguageServerMetadata> = {
|
||||||
[EditorLanguage.C]: {
|
[EditorLanguage.C]: {
|
||||||
protocol: "ws",
|
protocol: process.env.NEXT_PUBLIC_LSP_C_PROTOCOL || "ws",
|
||||||
hostname: "localhost",
|
hostname: process.env.NEXT_PUBLIC_LSP_C_HOSTNAME || "localhost",
|
||||||
port: 4594,
|
port: process.env.NEXT_PUBLIC_LSP_C_PORT ? parseInt(process.env.NEXT_PUBLIC_LSP_C_PORT, 10) : 4594,
|
||||||
path: "/clangd",
|
path: process.env.NEXT_PUBLIC_LSP_C_PATH || "/clangd",
|
||||||
lang: EditorLanguageConfig[EditorLanguage.C],
|
lang: EditorLanguageConfig[EditorLanguage.C],
|
||||||
},
|
},
|
||||||
[EditorLanguage.CPP]: {
|
[EditorLanguage.CPP]: {
|
||||||
protocol: "ws",
|
protocol: process.env.NEXT_PUBLIC_LSP_CPP_PROTOCOL || "ws",
|
||||||
hostname: "localhost",
|
hostname: process.env.NEXT_PUBLIC_LSP_CPP_HOSTNAME || "localhost",
|
||||||
port: 4595,
|
port: process.env.NEXT_PUBLIC_LSP_CPP_PORT ? parseInt(process.env.NEXT_PUBLIC_LSP_CPP_PORT, 10) : 4595,
|
||||||
path: "/clangd",
|
path: process.env.NEXT_PUBLIC_LSP_CPP_PATH || "/clangd",
|
||||||
lang: EditorLanguageConfig[EditorLanguage.CPP],
|
lang: EditorLanguageConfig[EditorLanguage.CPP],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user