make verifyApiKey not apply in docs

pull/9078/head
Agusti Fernandez Pardo 2022-04-15 16:47:08 +02:00
parent 09d8b48ccc
commit e251fccb61
1 changed files with 1 additions and 1 deletions

View File

@ -14,7 +14,7 @@ const today = new Date();
// This verifies the API key and sets the user if it is valid. // This verifies the API key and sets the user if it is valid.
export const verifyApiKey: NextMiddleware = async (req, res, next) => { export const verifyApiKey: NextMiddleware = async (req, res, next) => {
const pathIsDocs = req.url?.startsWith("/docs"); const pathIsDocs = req.url?.startsWith("/docs");
if (pathIsDocs) await next() if (pathIsDocs) await next();
if (!req.query.apiKey) res.status(401).json({ message: "No API key provided" }); if (!req.query.apiKey) res.status(401).json({ message: "No API key provided" });
const strippedApiKey = `${req.query.apiKey}`.replace(process.env.API_KEY_PREFIX || "cal_", ""); const strippedApiKey = `${req.query.apiKey}`.replace(process.env.API_KEY_PREFIX || "cal_", "");