()
| 116 | } |
| 117 | |
| 118 | export 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 | |
| 144 | export const runInfo = async (options: InfoOptions): Promise<number> => { |
| 145 | const payload = await getInfoPayload() |
no test coverage detected