logInfo => logError
This commit is contained in:
12
src/index.ts
12
src/index.ts
@@ -1,5 +1,5 @@
|
|||||||
import { WsService } from "@dpu/shared";
|
import { WsService } from "@dpu/shared";
|
||||||
import { logInfo } from "@dpu/shared/dist/logger.js";
|
import { logError } from "@dpu/shared/dist/logger.js";
|
||||||
import fastifyCors from "@fastify/cors";
|
import fastifyCors from "@fastify/cors";
|
||||||
import fastifySwagger from "@fastify/swagger";
|
import fastifySwagger from "@fastify/swagger";
|
||||||
import fastifySwaggerUi from "@fastify/swagger-ui";
|
import fastifySwaggerUi from "@fastify/swagger-ui";
|
||||||
@@ -8,10 +8,10 @@ import type { FastifyReply, FastifyRequest } from "fastify";
|
|||||||
import Fastify from "fastify";
|
import Fastify from "fastify";
|
||||||
import fastifyAxios from "fastify-axios";
|
import fastifyAxios from "fastify-axios";
|
||||||
import {
|
import {
|
||||||
jsonSchemaTransform,
|
jsonSchemaTransform,
|
||||||
serializerCompiler,
|
serializerCompiler,
|
||||||
validatorCompiler,
|
validatorCompiler,
|
||||||
type ZodTypeProvider,
|
type ZodTypeProvider,
|
||||||
} from "fastify-type-provider-zod";
|
} from "fastify-type-provider-zod";
|
||||||
import { SwaggerTheme, SwaggerThemeNameEnum } from "swagger-themes";
|
import { SwaggerTheme, SwaggerThemeNameEnum } from "swagger-themes";
|
||||||
import { z } from "zod";
|
import { z } from "zod";
|
||||||
@@ -117,7 +117,7 @@ async function verifyAPIKey(
|
|||||||
const apiKey = request.headers["x-api-key"];
|
const apiKey = request.headers["x-api-key"];
|
||||||
|
|
||||||
if (!apiKey || apiKey !== Config.api_key) {
|
if (!apiKey || apiKey !== Config.api_key) {
|
||||||
logInfo("POST Request with wrong API key received");
|
logError("POST Request with wrong API key received");
|
||||||
return reply.code(401).send({ error: "Invalid API key" });
|
return reply.code(401).send({ error: "Invalid API key" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user