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.
This commit is contained in:
@@ -16,8 +16,8 @@ describe('loadEnv', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws when STEAM_API_KEY is missing', () => {
|
it('allows a missing STEAM_API_KEY', () => {
|
||||||
expect(() => loadEnv({})).toThrow(/STEAM_API_KEY/);
|
expect(loadEnv({})).toEqual({ PORT: 3000 });
|
||||||
});
|
});
|
||||||
|
|
||||||
it('throws on an invalid PORT', () => {
|
it('throws on an invalid PORT', () => {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
const envSchema = z.object({
|
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),
|
PORT: z.coerce.number().int().min(1).max(65535).default(3000),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -9,7 +9,7 @@ export type Env = z.infer<typeof envSchema>;
|
|||||||
|
|
||||||
/** Hono bindings type so `c.env` is typed in route handlers. */
|
/** Hono bindings type so `c.env` is typed in route handlers. */
|
||||||
export interface Bindings {
|
export interface Bindings {
|
||||||
STEAM_API_KEY: string;
|
STEAM_API_KEY?: string;
|
||||||
PORT: number;
|
PORT: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user