WaledRashed24/comics
0
1"use server"2 3import { getValidBoolean } from "@/lib/getValidBoolean"4import { getValidNumber } from "@/lib/getValidNumber"5import { getValidString } from "@/lib/getValidString"6import { DynamicConfig } from "@/types"7 8export async function getDynamicConfig(): Promise<DynamicConfig> {9 const maxNbPages = getValidNumber(process.env.MAX_NB_PAGES, 1, Number.MAX_SAFE_INTEGER, 1)10 const nbPanelsPerPage = 4 // for now this is static11 const nbTotalPanelsToGenerate = maxNbPages * nbPanelsPerPage12 13 const config = {14 maxNbPages,15 nbPanelsPerPage,16 nbTotalPanelsToGenerate,17 oauthClientId: getValidString(process.env.HUGGING_FACE_OAUTH_CLIENT_ID, ""),18 19 // this doesn't work (conceptually)20 oauthRedirectUrl: getValidString(process.env.HUGGING_FACE_OAUTH_REDIRECT_URL, ""),21 22 oauthScopes: "openid profile inference-api",23 enableHuggingFaceOAuth: getValidBoolean(process.env.ENABLE_HUGGING_FACE_OAUTH, false),24 enableHuggingFaceOAuthWall: getValidBoolean(process.env.ENABLE_HUGGING_FACE_OAUTH_WALL, false),25 }26 27 return config28}