From 4ffe858c36a3dd67350d0cd9160619150fd3a24d Mon Sep 17 00:00:00 2001 From: hypercross Date: Sat, 8 Aug 2026 11:28:58 +0800 Subject: [PATCH] fix: make STEAM_API_KEY optional so the proxy starts without it The proxy now boots without a key; /items routes still return 500 when a key is required but missing. --- apps/proxy/src/env.test.ts | 4 ++-- apps/proxy/src/env.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/proxy/src/env.test.ts b/apps/proxy/src/env.test.ts index fa8591a..b3925ea 100644 --- a/apps/proxy/src/env.test.ts +++ b/apps/proxy/src/env.test.ts @@ -16,8 +16,8 @@ describe('loadEnv', () => { }); }); - it('throws when STEAM_API_KEY is missing', () => { - expect(() => loadEnv({})).toThrow(/STEAM_API_KEY/); + it('allows a missing STEAM_API_KEY', () => { + expect(loadEnv({})).toEqual({ PORT: 3000 }); }); it('throws on an invalid PORT', () => { diff --git a/apps/proxy/src/env.ts b/apps/proxy/src/env.ts index 9c8ef32..3819f02 100644 --- a/apps/proxy/src/env.ts +++ b/apps/proxy/src/env.ts @@ -1,7 +1,7 @@ import { z } from 'zod'; const envSchema = z.object({ - STEAM_API_KEY: z.string().min(1, 'STEAM_API_KEY is required'), + STEAM_API_KEY: z.string().min(1).optional(), PORT: z.coerce.number().int().min(1).max(65535).default(3000), }); @@ -9,7 +9,7 @@ export type Env = z.infer; /** Hono bindings type so `c.env` is typed in route handlers. */ export interface Bindings { - STEAM_API_KEY: string; + STEAM_API_KEY?: string; PORT: number; }