mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-20 12:19:06 +00:00
github debug
This commit is contained in:
@@ -17,32 +17,35 @@ import {
|
|||||||
deleteTokenCache,
|
deleteTokenCache,
|
||||||
} from "./redisTokenCache";
|
} from "./redisTokenCache";
|
||||||
import { tokenCacheRedis } from "./redisClient";
|
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)
|
// 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 TOKEN_CACHE_TTL = REFRESH_ACCESS_TOKEN_BEFORE;
|
||||||
|
|
||||||
const refreshLocks = new Map<string, Promise<JWTWithAccessToken>>();
|
const refreshLocks = new Map<string, Promise<JWTWithAccessToken>>();
|
||||||
|
|
||||||
const CLIENT_ID = assertExistsAndNonEmptyString(
|
const CLIENT_ID = !isCI
|
||||||
process.env.AUTHENTIK_CLIENT_ID,
|
? assertExistsAndNonEmptyString(process.env.AUTHENTIK_CLIENT_ID)
|
||||||
);
|
: "noop";
|
||||||
const CLIENT_SECRET = assertExistsAndNonEmptyString(
|
const CLIENT_SECRET = !isCI
|
||||||
process.env.AUTHENTIK_CLIENT_SECRET,
|
? assertExistsAndNonEmptyString(process.env.AUTHENTIK_CLIENT_SECRET)
|
||||||
);
|
: "noop";
|
||||||
|
|
||||||
export const authOptions: AuthOptions = {
|
export const authOptions: AuthOptions = {
|
||||||
providers: [
|
providers: !isCI
|
||||||
AuthentikProvider({
|
? [
|
||||||
clientId: CLIENT_ID,
|
AuthentikProvider({
|
||||||
clientSecret: CLIENT_SECRET,
|
clientId: CLIENT_ID,
|
||||||
issuer: process.env.AUTHENTIK_ISSUER,
|
clientSecret: CLIENT_SECRET,
|
||||||
authorization: {
|
issuer: process.env.AUTHENTIK_ISSUER,
|
||||||
params: {
|
authorization: {
|
||||||
scope: "openid email profile offline_access",
|
params: {
|
||||||
},
|
scope: "openid email profile offline_access",
|
||||||
},
|
},
|
||||||
}),
|
},
|
||||||
],
|
}),
|
||||||
|
]
|
||||||
|
: [],
|
||||||
session: {
|
session: {
|
||||||
strategy: "jwt",
|
strategy: "jwt",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -32,11 +32,12 @@ export function edgeDomainToKey(domain: string) {
|
|||||||
export async function getConfig() {
|
export async function getConfig() {
|
||||||
if (isCI) {
|
if (isCI) {
|
||||||
// "noop"
|
// "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;
|
return require("../../config-template").localConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.env.NEXT_PUBLIC_ENV === "development") {
|
if (process.env.NEXT_PUBLIC_ENV === "development") {
|
||||||
// helps to
|
// helps to stop nextjs build from eager loading. don't inline it.
|
||||||
const configPath = "../../config";
|
const configPath = "../../config";
|
||||||
return require(configPath).localConfig;
|
return require(configPath).localConfig;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
// 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");
|
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 =
|
export const isCI =
|
||||||
process.env.CI === "true" ||
|
process.env.CI === "true" ||
|
||||||
process.env.IS_CI === "true" ||
|
process.env.IS_CI === "true" ||
|
||||||
|
|||||||
Reference in New Issue
Block a user