Debug sync-and-simulate cron: show curl output, log auth failures #83
2 changed files with 4 additions and 1 deletions
|
|
@ -9,6 +9,6 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- name: Sync standings and run simulations where changed
|
- name: Sync standings and run simulations where changed
|
||||||
run: |
|
run: |
|
||||||
curl -sf -X POST https://brackt.com/admin/jobs/sync-and-simulate \
|
curl -f -X POST https://brackt.com/admin/jobs/sync-and-simulate \
|
||||||
-H "X-Cron-Secret: ${{ secrets.CRON_SECRET }}" \
|
-H "X-Cron-Secret: ${{ secrets.CRON_SECRET }}" \
|
||||||
-H "Content-Type: application/json"
|
-H "Content-Type: application/json"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
|
import { logger } from "~/lib/logger";
|
||||||
|
|
||||||
export function requireCronSecret(request: Request): void {
|
export function requireCronSecret(request: Request): void {
|
||||||
const secret = process.env.CRON_SECRET;
|
const secret = process.env.CRON_SECRET;
|
||||||
if (!secret) throw new Response("CRON_SECRET not configured", { status: 500 });
|
if (!secret) throw new Response("CRON_SECRET not configured", { status: 500 });
|
||||||
if (request.headers.get("x-cron-secret") !== secret) {
|
if (request.headers.get("x-cron-secret") !== secret) {
|
||||||
|
logger.error("[cron-auth] Invalid or missing X-Cron-Secret header");
|
||||||
throw new Response("Unauthorized", { status: 401 });
|
throw new Response("Unauthorized", { status: 401 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue