Skip to content

Commit 51af334

Browse files
fix faulty if statement and replace the DECO_RELOAD_TOKENto DECO_RELEASE_RELOAD_TOKEN
1 parent 0b99245 commit 51af334

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

runtime/routes/reload.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
import { createHandler } from "../middleware.ts";
22

3-
const RELOAD_TOKEN = Deno.env.get("DECO_RELOAD_TOKEN");
3+
const RELOAD_TOKEN = Deno.env.get("DECO_RELEASE_RELOAD_TOKEN");
44
export const handler = createHandler(async (
55
{ var: state, req },
66
) => {
77
// Parse request body to get the decofile
88
const token = req.header("Authorization")?.split(" ")[1];
9-
if (RELOAD_TOKEN && token !== RELOAD_TOKEN) {
10-
return new Response(
11-
JSON.stringify({ error: "Unauthorized" }),
12-
{
13-
status: 401,
14-
},
15-
);
9+
if (!RELOAD_TOKEN || token !== RELOAD_TOKEN) {
10+
return new Response(JSON.stringify({ error: "Unauthorized" }), {
11+
status: 401,
12+
});
1613
}
1714
let decofile;
1815
let revision;

0 commit comments

Comments
 (0)