MCPcopy Index your code
hub / github.com/cameri/nostream / getInfoPayload

Function getInfoPayload

src/cli/commands/info.ts:118–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116}
117
118export const getInfoPayload = async () => {
119 const settings = loadMergedSettings()
120 const torHostnamePath = getTorHostnamePath()
121 const torHostname = fs.existsSync(torHostnamePath) ? fs.readFileSync(torHostnamePath, 'utf-8').trim() : null
122 const [eventCount, uptimeSeconds] = await Promise.all([getEventCount(), getRelayUptimeSeconds()])
123
124 return {
125 version: packageJson.version,
126 relay: {
127 name: settings.info?.name,
128 url: settings.info?.relay_url,
129 pubkey: settings.info?.pubkey,
130 paymentsEnabled: settings.payments?.enabled ?? false,
131 paymentProcessor: settings.payments?.processor ?? null,
132 },
133 tor: {
134 hostname: torHostname,
135 onionPrivateKeyPath: getOnionKeyPath(),
136 },
137 runtime: {
138 eventCount,
139 uptimeSeconds,
140 },
141 }
142}
143
144export const runInfo = async (options: InfoOptions): Promise<number> => {
145 const payload = await getInfoPayload()

Callers 1

runInfoFunction · 0.85

Calls 5

loadMergedSettingsFunction · 0.90
getTorHostnamePathFunction · 0.90
getOnionKeyPathFunction · 0.90
getEventCountFunction · 0.85
getRelayUptimeSecondsFunction · 0.85

Tested by

no test coverage detected