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:
9
.github/workflows/test_next_server.yml
vendored
9
.github/workflows/test_next_server.yml
vendored
@@ -42,11 +42,4 @@ jobs:
|
||||
run: pnpm install
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm test
|
||||
env:
|
||||
NEXT_PUBLIC_IS_CI: true
|
||||
|
||||
- name: Build
|
||||
run: pnpm build
|
||||
env:
|
||||
NEXT_PUBLIC_IS_CI: true
|
||||
run: pnpm test
|
||||
@@ -10,11 +10,8 @@ import {
|
||||
} from "@tanstack/react-query";
|
||||
import createFetchClient from "openapi-react-query";
|
||||
import { assertExistsAndNonEmptyString } from "./utils";
|
||||
import { isCI } from "./next";
|
||||
|
||||
const API_URL = !isCI
|
||||
? assertExistsAndNonEmptyString(process.env.NEXT_PUBLIC_API_URL)
|
||||
: "http://127.0.0.1:1250";
|
||||
const API_URL = assertExistsAndNonEmptyString(process.env.NEXT_PUBLIC_API_URL);
|
||||
|
||||
// Create the base openapi-fetch client with a default URL
|
||||
// The actual URL will be set via middleware in AuthProvider
|
||||
|
||||
@@ -17,16 +17,15 @@ 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 = !isCI
|
||||
? assertExistsAndNonEmptyString(process.env.AUTHENTIK_CLIENT_ID)
|
||||
: "noop";
|
||||
const CLIENT_ID = assertExistsAndNonEmptyString(
|
||||
process.env.AUTHENTIK_CLIENT_ID,
|
||||
);
|
||||
const CLIENT_SECRET = !isCI
|
||||
? assertExistsAndNonEmptyString(process.env.AUTHENTIK_CLIENT_SECRET)
|
||||
: "noop";
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import { get } from "@vercel/edge-config";
|
||||
|
||||
import { isBuildPhase, isCI } from "./next";
|
||||
|
||||
type EdgeConfig = {
|
||||
[domainWithDash: string]: {
|
||||
features: {
|
||||
@@ -30,12 +28,6 @@ export function edgeDomainToKey(domain: string) {
|
||||
|
||||
// get edge config server-side (prefer DomainContext when available), domain is the hostname
|
||||
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 stop nextjs build from eager loading. don't inline it.
|
||||
const configPath = "../../config";
|
||||
|
||||
@@ -1,7 +1,2 @@
|
||||
// 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");
|
||||
// useful for "next build" conditional executions
|
||||
export const isCI =
|
||||
process.env.CI === "true" ||
|
||||
process.env.IS_CI === "true" ||
|
||||
process.env.NEXT_PUBLIC_IS_CI === "true";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import Redis from "ioredis";
|
||||
import { isBuildPhase } from "./next";
|
||||
|
||||
export type RedisClient = Pick<Redis, "get" | "setex" | "del">;
|
||||
|
||||
@@ -27,20 +26,4 @@ const getRedisClient = (): RedisClient => {
|
||||
return redis;
|
||||
};
|
||||
|
||||
// next.js buildtime usage - we want to isolate next.js "build" time concepts here
|
||||
const noopClient: RedisClient = (() => {
|
||||
const noopSetex: Redis["setex"] = async () => {
|
||||
return "OK" as const;
|
||||
};
|
||||
const noopDel: Redis["del"] = async () => {
|
||||
return 0;
|
||||
};
|
||||
return {
|
||||
get: async () => {
|
||||
return null;
|
||||
},
|
||||
setex: noopSetex,
|
||||
del: noopDel,
|
||||
};
|
||||
})();
|
||||
export const tokenCacheRedis = isBuildPhase ? noopClient : getRedisClient();
|
||||
export const tokenCacheRedis = getRedisClient();
|
||||
|
||||
Reference in New Issue
Block a user