Skip to content

Commit

Permalink
fix(apps/evm): cron job auth
Browse files Browse the repository at this point in the history
  • Loading branch information
OlaStenberg committed Nov 11, 2023
1 parent 45a867a commit 6036a72
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions apps/evm/src/app/api/cron/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,9 @@ import { NextResponse } from "next/server";
import { DEFAULT_LIST_OF_LISTS } from "sushi";

export async function GET(req: Request) {
const authToken = (req.headers.get("authorization") || "")
.split("Bearer ")
.at(1);
if (!authToken || authToken !== process.env.CRON_SECRET) {
return NextResponse.json(
{ error: "Unauthorized" },
{
status: 401,
},
);
}
if (req.headers.get('Authorization') !== `Bearer ${process.env.CRON_SECRET}`) {
return NextResponse.json('Unauthorized', { status: 401 });
}

if (!process.env.UPSTASH_SUSHISWAP_REDIS_REST_URL)
throw new Error("UPSTASH_REDIS_REST_URL undefined");
Expand Down

0 comments on commit 6036a72

Please sign in to comment.