From 7b0a7e711d953d811062924fb292d0c3fbd4c191 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Fri, 17 Mar 2023 16:20:29 -0400 Subject: [PATCH] fix(striker-ui-api): add get host name to access module --- striker-ui-api/src/lib/accessModule.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/striker-ui-api/src/lib/accessModule.ts b/striker-ui-api/src/lib/accessModule.ts index f1b02268..6365cd54 100644 --- a/striker-ui-api/src/lib/accessModule.ts +++ b/striker-ui-api/src/lib/accessModule.ts @@ -148,6 +148,22 @@ const getAnvilData = ( spawnSyncOptions, ).stdout; +const getLocalHostName = () => { + let result: string; + + try { + result = execModuleSubroutine('host_name', { + subModuleName: 'Get', + }).stdout; + } catch (subError) { + throw new Error(`Failed to get local host name; CAUSE: ${subError}`); + } + + shout(`localHostName=${result}`); + + return result; +}; + const getLocalHostUUID = () => { let result: string; @@ -156,7 +172,7 @@ const getLocalHostUUID = () => { subModuleName: 'Get', }).stdout; } catch (subError) { - throw new Error(`Failed to get localhost UUID; CAUSE: ${subError}`); + throw new Error(`Failed to get local host UUID; CAUSE: ${subError}`); } shout(`localHostUUID=[${result}]`); @@ -201,6 +217,7 @@ export { dbSubRefreshTimestamp, dbWrite, getAnvilData, + getLocalHostName, getLocalHostUUID, getPeerData, execModuleSubroutine as sub,