github debug

This commit is contained in:
Igor Loskutov
2025-09-04 21:39:45 -04:00
parent 03f2d2a30b
commit 50d4bcc0ac
3 changed files with 24 additions and 20 deletions

View File

@@ -17,21 +17,23 @@ 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<string, Promise<JWTWithAccessToken>>();
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: [
providers: !isCI
? [
AuthentikProvider({
clientId: CLIENT_ID,
clientSecret: CLIENT_SECRET,
@@ -42,7 +44,8 @@ export const authOptions: AuthOptions = {
},
},
}),
],
]
: [],
session: {
strategy: "jwt",
},

View File

@@ -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;
}

View File

@@ -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" ||