feat(ide_services): add endpoint for retrieving local service port

Add a new endpoint `/get_local_service_port` to ide_services for obtaining the port
number of the local service. This endpoint utilizes the `getLocalServicePort` function,
which logs the local service port and retrieves it from the environment variable
`DC_LOCALSERVICE_PORT`.
This commit is contained in:
Rankin Zheng 2024-08-27 17:35:23 +08:00
parent adedbec510
commit 3e2ccd5ab2
2 changed files with 12 additions and 1 deletions

View File

@ -7,3 +7,10 @@ export async function getServicePort() {
// return await UiUtilWrapper.getLSPBrigePort();
return process.env.DEVCHAT_IDE_SERVICE_PORT;
}
export async function getLocalServicePort() {
logger
.channel()
?.info(`get local service port: ${process.env.DC_LOCALSERVICE_PORT}`);
return process.env.DC_LOCALSERVICE_PORT;
}

View File

@ -3,7 +3,7 @@ import * as http from "http";
import * as querystring from "querystring";
import { logger } from "../util/logger";
import { getServicePort } from "./endpoints/getServicePort";
import { getServicePort, getLocalServicePort } from "./endpoints/getServicePort";
import { installPythonEnv } from "./endpoints/installPythonEnv";
import { ideLogging} from "./endpoints/ideLogging";
import { updateSlashCommands } from "./endpoints/updateSlashCommands";
@ -26,6 +26,10 @@ const functionRegistry: any = {
keys: [],
handler: getServicePort,
},
"/get_local_service_port": {
keys: [],
handler: getLocalServicePort,
},
"/install_python_env": {
keys: ["command_name", "requirements_file"],
handler: installPythonEnv,