Skip to content

Commit 3e2ccd5

Browse files
author
Rankin Zheng
committed
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`.
1 parent adedbec commit 3e2ccd5

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/ide_services/endpoints/getServicePort.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,10 @@ export async function getServicePort() {
77
// return await UiUtilWrapper.getLSPBrigePort();
88
return process.env.DEVCHAT_IDE_SERVICE_PORT;
99
}
10+
11+
export async function getLocalServicePort() {
12+
logger
13+
.channel()
14+
?.info(`get local service port: ${process.env.DC_LOCALSERVICE_PORT}`);
15+
return process.env.DC_LOCALSERVICE_PORT;
16+
}

src/ide_services/services.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as http from "http";
33
import * as querystring from "querystring";
44
import { logger } from "../util/logger";
55

6-
import { getServicePort } from "./endpoints/getServicePort";
6+
import { getServicePort, getLocalServicePort } from "./endpoints/getServicePort";
77
import { installPythonEnv } from "./endpoints/installPythonEnv";
88
import { ideLogging} from "./endpoints/ideLogging";
99
import { updateSlashCommands } from "./endpoints/updateSlashCommands";
@@ -26,6 +26,10 @@ const functionRegistry: any = {
2626
keys: [],
2727
handler: getServicePort,
2828
},
29+
"/get_local_service_port": {
30+
keys: [],
31+
handler: getLocalServicePort,
32+
},
2933
"/install_python_env": {
3034
keys: ["command_name", "requirements_file"],
3135
handler: installPythonEnv,

0 commit comments

Comments
 (0)