Skip to content

Commit

Permalink
fix: check token per span
Browse files Browse the repository at this point in the history
  • Loading branch information
tschoffelen committed Sep 7, 2024
1 parent bba6a7c commit ea1178d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/api/src/routes/collector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ const app = new Hono();
app.post("/", async (c) => {
const body = await c.req.json();

if (process.env.TRACER_TOKEN && body.token !== process.env.TRACER_TOKEN) {
console.log(`Invalid token: ${body.token}`);
return c.json({ error: "Invalid token" }, 401);
}

for (const span of body) {
console.log(span);

if (process.env.TRACER_TOKEN && span.token !== process.env.TRACER_TOKEN) {
console.log(`Invalid token: ${span.token}`);
continue;
}

if (span.type === "log") {
// save log span
await put(
Expand Down

0 comments on commit ea1178d

Please sign in to comment.