correction after review

This commit is contained in:
Первов Артем
2026-06-19 08:17:35 +03:00
parent 7cf4aacd11
commit 10dbdb2120
2 changed files with 7 additions and 18 deletions

View File

@@ -1,25 +1,15 @@
const DEFAULT_CLOUD_INGEST_URL = 'http://localhost:3100/ingest'
const DEFAULT_CLOUD_INGEST_URL = 'http://localhost:3101/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(),
headers: {
'content-type': 'application/json',
'x-api-key': process.env.CLOUD_INGEST_API_KEY as string,
},
body: JSON.stringify(body),
})
}