Skip to content

Commit 2ddd3a2

Browse files
Use correct env variable.
1 parent ca43b7a commit 2ddd3a2

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

cloudflare-workers/workouts/specification.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Single-user REST API implemented as a Cloudflare Worker with a bound KV namespac
88

99
export interface Env {
1010
WORKOUTS: KVNamespace;
11-
API_BEARER_TOKEN: string; // secret
11+
WORKOUT_API_TOKEN: string; // secret
1212
}
1313

1414
All data is stored in WORKOUTS. The API is designed for one authenticated user and assumes low-to-moderate data volume (personal use).
@@ -31,7 +31,7 @@ Authorization: Bearer <token>
3131

3232
Behavior
3333
• If header missing or malformed → 401 Unauthorized
34-
• If token != Env.API_BEARER_TOKEN → 401 Unauthorized
34+
• If token != Env.WORKOUT_API_TOKEN → 401 Unauthorized
3535

3636
Error format (standard)
3737

cloudflare-workers/workouts/worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ async function updateExerciseRecordsFromSession(env, session) {
189189
async function ensureAuth(request, env) {
190190
const header = request.headers.get("Authorization") || "";
191191
const token = header.replace(/^Bearer\s+/i, "").trim();
192-
if (!token || token !== env.API_BEARER_TOKEN) {
192+
if (!token || token !== env.WORKOUT_API_TOKEN) {
193193
return false;
194194
}
195195
return true;

0 commit comments

Comments
 (0)