tambahan
This commit is contained in:
@@ -1,20 +1,20 @@
|
|||||||
import { Elysia } from "elysia";
|
import { Elysia } from "elysia";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
|
|
||||||
const API_KEY = process.env.MCP_API_KEY ?? "super-secret-key";
|
// const API_KEY = process.env.MCP_API_KEY ?? "super-secret-key";
|
||||||
const PORT = Number(process.env.PORT ?? 3000);
|
// const PORT = Number(process.env.PORT ?? 3000);
|
||||||
|
|
||||||
// =====================
|
// // =====================
|
||||||
// Helper Functions
|
// // Helper Functions
|
||||||
// =====================
|
// // =====================
|
||||||
function isAuthorized(headers: Headers) {
|
// function isAuthorized(headers: Headers) {
|
||||||
const authHeader = headers.get("authorization");
|
// const authHeader = headers.get("authorization");
|
||||||
if (authHeader?.startsWith("Bearer ")) {
|
// if (authHeader?.startsWith("Bearer ")) {
|
||||||
const token = authHeader.substring(7);
|
// const token = authHeader.substring(7);
|
||||||
return token === API_KEY;
|
// return token === API_KEY;
|
||||||
}
|
// }
|
||||||
return headers.get("x-api-key") === API_KEY;
|
// return headers.get("x-api-key") === API_KEY;
|
||||||
}
|
// }
|
||||||
|
|
||||||
// =====================
|
// =====================
|
||||||
// Tools Definition
|
// Tools Definition
|
||||||
|
|||||||
Reference in New Issue
Block a user