remove redundant parse

This commit is contained in:
Первов Артем
2026-06-17 09:40:43 +03:00
parent f8a9866339
commit 7cf4aacd11
6 changed files with 35 additions and 36 deletions

25
app/src/cloud-ingest.ts Normal file
View File

@@ -0,0 +1,25 @@
const DEFAULT_CLOUD_INGEST_URL = 'http://localhost:3100/ingest'
export const cloudIngestUrl =
process.env.CLOUD_INGEST_URL ?? DEFAULT_CLOUD_INGEST_URL
function getHeaders(): Record<string, string> {
const headers: Record<string, string> = {
'content-type': 'application/json',
}
const apiKey = process.env.CLOUD_INGEST_API_KEY?.trim()
if (apiKey) {
headers['x-api-key'] = apiKey
}
return headers
}
export function postCloudIngest(body: unknown): Promise<Response> {
return fetch(cloudIngestUrl, {
method: 'POST',
headers: getHeaders(),
body: JSON.stringify(body),
})
}