1import * as _ from 'lodash-es' 6export const inClusterKey = 'inCluster' 8export const getInCluster = (): string => getReqEnvConfItem(inClusterKey) as string 10export const getReqEnvConfItem = (key: string): unknown => { 12 throwIf(() => !_.has(envConf, key), {missingKey: key, envConf}) 16export const getNextSvcPortNo = () => { 17 const envOverride = process.env.NEXT_SVC_PORT_NO 18 if (envOverride) return parseInt(envOverride, 10) 19 return getReqEnvConfItem('nextSvcPortNo') 22// Derive test-instance-ness from the bound port rather than a boolean env var: 23// a process is a test instance iff its bound port (NEXT_SVC_PORT_NO override, set by startDevServer) 24// equals the app's testSvcPortNo (and that differs from svcPortNo). The port is the source of truth. 25export const getIsTestInstance = (): boolean => { 27 if (!testSvcPortNo || testSvcPortNo === svcPortNo) return false 28 try { return getNextSvcPortNo() === testSvcPortNo } catch { return false } 31export const getKlustersNodePorts = () => { 32 // appCfgCtx fallback needed: devpc setprocenv sets allNodePorts on appCfgCtx, not envConf 35 return appCfg?.allNodePorts || envConf.allNodePorts || envConf.nodePorts