mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Handle docs placeholder env values
This commit is contained in:
parent
a278a6b4b1
commit
82c469775a
@ -1,13 +1,22 @@
|
||||
import { StackServerApp } from '@hexclave/next';
|
||||
import "server-only";
|
||||
|
||||
const placeholderPrefix = "#";
|
||||
|
||||
function envOrUndefined(value: string | undefined): string | undefined {
|
||||
if (value == null || value === "" || value.startsWith(placeholderPrefix)) {
|
||||
return undefined;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// Explicitly configure Stack Auth for docs app
|
||||
export const stackServerApp = new StackServerApp({
|
||||
tokenStore: "nextjs-cookie",
|
||||
projectId: process.env.NEXT_PUBLIC_HEXCLAVE_PROJECT_ID || process.env.NEXT_PUBLIC_STACK_PROJECT_ID || "internal",
|
||||
publishableClientKey: process.env.NEXT_PUBLIC_HEXCLAVE_PUBLISHABLE_CLIENT_KEY || process.env.NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY,
|
||||
secretServerKey: process.env.HEXCLAVE_SECRET_SERVER_KEY || process.env.STACK_SECRET_SERVER_KEY,
|
||||
baseUrl: process.env.NEXT_PUBLIC_HEXCLAVE_API_URL || process.env.NEXT_PUBLIC_STACK_API_URL,
|
||||
projectId: envOrUndefined(process.env.NEXT_PUBLIC_HEXCLAVE_PROJECT_ID) ?? envOrUndefined(process.env.NEXT_PUBLIC_STACK_PROJECT_ID) ?? "internal",
|
||||
publishableClientKey: envOrUndefined(process.env.NEXT_PUBLIC_HEXCLAVE_PUBLISHABLE_CLIENT_KEY) ?? envOrUndefined(process.env.NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY),
|
||||
secretServerKey: envOrUndefined(process.env.HEXCLAVE_SECRET_SERVER_KEY) ?? envOrUndefined(process.env.STACK_SECRET_SERVER_KEY) ?? "this-secret-server-key-is-for-local-development-only",
|
||||
baseUrl: envOrUndefined(process.env.NEXT_PUBLIC_HEXCLAVE_API_URL) ?? envOrUndefined(process.env.NEXT_PUBLIC_STACK_API_URL),
|
||||
analytics: {
|
||||
replays: {
|
||||
enabled: true,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user