From 50d4bcc0ac89e3048d3bb253481cdc1dd1019583 Mon Sep 17 00:00:00 2001 From: Igor Loskutov Date: Thu, 4 Sep 2025 21:39:45 -0400 Subject: [PATCH] github debug --- www/app/lib/authBackend.ts | 39 ++++++++++++++++++++------------------ www/app/lib/edgeConfig.ts | 3 ++- www/app/lib/next.ts | 2 +- 3 files changed, 24 insertions(+), 20 deletions(-) diff --git a/www/app/lib/authBackend.ts b/www/app/lib/authBackend.ts index 81f3a4b2..45548054 100644 --- a/www/app/lib/authBackend.ts +++ b/www/app/lib/authBackend.ts @@ -17,32 +17,35 @@ import { deleteTokenCache, } from "./redisTokenCache"; import { tokenCacheRedis } from "./redisClient"; +import { isCI } from "./next"; // REFRESH_ACCESS_TOKEN_BEFORE because refresh is based on access token expiration (imagine we cache it 30 days) const TOKEN_CACHE_TTL = REFRESH_ACCESS_TOKEN_BEFORE; const refreshLocks = new Map>(); -const CLIENT_ID = assertExistsAndNonEmptyString( - process.env.AUTHENTIK_CLIENT_ID, -); -const CLIENT_SECRET = assertExistsAndNonEmptyString( - process.env.AUTHENTIK_CLIENT_SECRET, -); +const CLIENT_ID = !isCI + ? assertExistsAndNonEmptyString(process.env.AUTHENTIK_CLIENT_ID) + : "noop"; +const CLIENT_SECRET = !isCI + ? assertExistsAndNonEmptyString(process.env.AUTHENTIK_CLIENT_SECRET) + : "noop"; export const authOptions: AuthOptions = { - providers: [ - AuthentikProvider({ - clientId: CLIENT_ID, - clientSecret: CLIENT_SECRET, - issuer: process.env.AUTHENTIK_ISSUER, - authorization: { - params: { - scope: "openid email profile offline_access", - }, - }, - }), - ], + providers: !isCI + ? [ + AuthentikProvider({ + clientId: CLIENT_ID, + clientSecret: CLIENT_SECRET, + issuer: process.env.AUTHENTIK_ISSUER, + authorization: { + params: { + scope: "openid email profile offline_access", + }, + }, + }), + ] + : [], session: { strategy: "jwt", }, diff --git a/www/app/lib/edgeConfig.ts b/www/app/lib/edgeConfig.ts index 59b1bcc9..cd0e5a47 100644 --- a/www/app/lib/edgeConfig.ts +++ b/www/app/lib/edgeConfig.ts @@ -32,11 +32,12 @@ export function edgeDomainToKey(domain: string) { export async function getConfig() { if (isCI) { // "noop" + // TODO sometime later we may have proper config if we have bigger test suite that requires values from the config return require("../../config-template").localConfig; } if (process.env.NEXT_PUBLIC_ENV === "development") { - // helps to + // helps to stop nextjs build from eager loading. don't inline it. const configPath = "../../config"; return require(configPath).localConfig; } diff --git a/www/app/lib/next.ts b/www/app/lib/next.ts index 88038d45..bdc58eb4 100644 --- a/www/app/lib/next.ts +++ b/www/app/lib/next.ts @@ -1,6 +1,6 @@ // next.js tries to run all the lib code during build phase; we don't always want it when e.g. we have connections initialized we don't want to have export const isBuildPhase = process.env.NEXT_PHASE?.includes("build"); -// for future usage - could be useful for "next build" conditional executions +// useful for "next build" conditional executions export const isCI = process.env.CI === "true" || process.env.IS_CI === "true" ||