fix: proper isProd check in auth (#457)

This commit is contained in:
Brace Sproul 2025-07-21 12:27:05 -07:00 • committed by GitHub
parent 05bc1b3559
commit 4f31962b4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -88,9 +88,9 @@ function isRunReq(reqUrl: string): boolean {
export const auth = new Auth() export const auth = new Auth()
.authenticate<AuthenticateReturn>(async (request: Request) => { .authenticate<AuthenticateReturn>(async (request: Request) => {
const isProdEnv = process.env.NODE_ENV === "production"; const isProd = process.env.NODE_ENV === "production";
// Disable all requests to the server in prod for now. // Disable all requests to the server in prod for now.
if (!isProdEnv) { if (isProd) {
return new HTTPException(504, { return new HTTPException(504, {
message: "Open SWE temporarily disabled.", message: "Open SWE temporarily disabled.",
}) as any; }) as any;
@ -108,8 +108,6 @@ export const auth = new Auth()
}; };
} }
const isProd = process.env.NODE_ENV === "production";
const ghSecretHashHeader = request.headers.get("X-Hub-Signature-256"); const ghSecretHashHeader = request.headers.get("X-Hub-Signature-256");
if (ghSecretHashHeader) { if (ghSecretHashHeader) {
// This will either return a valid user, or throw an error // This will either return a valid user, or throw an error