Use HEXCLAVE_ env var names in Next.js setup keys and fix default API URL check

The Next.js .env generator still emitted legacy STACK_/NEXT_PUBLIC_STACK_
variable names after the Hexclave rebrand, inconsistent with the Vite block
and TanStack setup prompt. Switch it to the HEXCLAVE_ prefix (the SDK
dual-reads HEXCLAVE_* ?? STACK_*, so existing projects are unaffected).

Also correct the default-API-URL comparison in both the Next.js and Vite
generators to the actual current value (https://api.stack-auth.com), so the
API URL override is omitted from generated env files when running against
the default cloud.
This commit is contained in:
Bilal Godil 2026-06-01 19:35:03 -07:00
parent 8fc11e1c93
commit ed6b4ef09d

View File

@ -8,11 +8,11 @@ function getEnvFileContent(props: {
superSecretAdminKey?: string,
}) {
const envFileContent = Object.entries({
NEXT_PUBLIC_STACK_API_URL: getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL') === "https://api.hexclave.com" ? undefined : getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL'),
NEXT_PUBLIC_STACK_PROJECT_ID: props.projectId,
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY: props.publishableClientKey,
STACK_SECRET_SERVER_KEY: props.secretServerKey,
STACK_SUPER_SECRET_ADMIN_KEY: props.superSecretAdminKey,
NEXT_PUBLIC_HEXCLAVE_API_URL: getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL') === "https://api.stack-auth.com" ? undefined : getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL'),
NEXT_PUBLIC_HEXCLAVE_PROJECT_ID: props.projectId,
NEXT_PUBLIC_HEXCLAVE_PUBLISHABLE_CLIENT_KEY: props.publishableClientKey,
HEXCLAVE_SECRET_SERVER_KEY: props.secretServerKey,
HEXCLAVE_SUPER_SECRET_ADMIN_KEY: props.superSecretAdminKey,
})
.filter(([k, v]) => v)
.map(([k, v]) => `${k}=${v}`)
@ -133,7 +133,7 @@ export function ViteEnvKeys(props: {
secretServerKey?: string,
}) {
const envFileContent = Object.entries({
VITE_HEXCLAVE_API_URL: getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL') === "https://api.hexclave.com" ? undefined : getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL'),
VITE_HEXCLAVE_API_URL: getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL') === "https://api.stack-auth.com" ? undefined : getPublicEnvVar('NEXT_PUBLIC_STACK_API_URL'),
VITE_HEXCLAVE_PROJECT_ID: props.projectId,
HEXCLAVE_SECRET_SERVER_KEY: props.secretServerKey,
})