correction after review
This commit is contained in:
@@ -3,10 +3,9 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "node --env-file-if-exists=.env ./node_modules/tsx/dist/cli.mjs watch src/index.ts",
|
||||
"start": "node --env-file-if-exists=.env ./node_modules/tsx/dist/cli.mjs src/index.ts",
|
||||
"dev": "tsx watch --env-file=.env src/index.ts",
|
||||
"build": "tsc",
|
||||
"typecheck": "tsc --noEmit"
|
||||
"start": "node --env-file=.env dist/index.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "^25.9.1",
|
||||
|
||||
@@ -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),
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user