mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-13 21:01:21 +08:00
refactor(env): replace StackAssertionError with HexclaveAssertionError and update envOrDevDefault calls for consistency
This commit is contained in:
parent
f09e708447
commit
ee019b0435
@ -1,4 +1,4 @@
|
||||
import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
|
||||
import { HexclaveAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
|
||||
|
||||
const IS_DEV = process.env.NODE_ENV === "development";
|
||||
const PLACEHOLDER = "REPLACE_ME";
|
||||
@ -12,7 +12,7 @@ const PLACEHOLDER = "REPLACE_ME";
|
||||
export function envOrDevDefault(value: string | undefined, devDefault: string, name: string): string {
|
||||
if (!value || value === PLACEHOLDER) {
|
||||
if (IS_DEV) return devDefault;
|
||||
throw new StackAssertionError(`${name} is not configured. Set the NEXT_PUBLIC_STACK_* vars in .env.local or the hosting platform env.`);
|
||||
throw new HexclaveAssertionError(`${name} is not configured. Set the NEXT_PUBLIC_STACK_* vars in .env.local or the hosting platform env.`);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import { envOrDevDefault } from "./env";
|
||||
|
||||
const PORT_PREFIX = process.env.NEXT_PUBLIC_HEXCLAVE_PORT_PREFIX ?? "81";
|
||||
const API_URL = envOrDevDefault(process.env.NEXT_PUBLIC_STACK_API_URL, `http://localhost:${PORT_PREFIX}02`);
|
||||
const PROJECT_ID = envOrDevDefault(process.env.NEXT_PUBLIC_STACK_PROJECT_ID, "internal");
|
||||
const API_URL = envOrDevDefault(process.env.NEXT_PUBLIC_STACK_API_URL, `http://localhost:${PORT_PREFIX}02`, "NEXT_PUBLIC_STACK_API_URL");
|
||||
const PROJECT_ID = envOrDevDefault(process.env.NEXT_PUBLIC_STACK_PROJECT_ID, "internal", "NEXT_PUBLIC_STACK_PROJECT_ID");
|
||||
const PUBLISHABLE_CLIENT_KEY = envOrDevDefault(
|
||||
process.env.NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY,
|
||||
"this-publishable-client-key-is-for-local-development-only",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user