mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-30 21:01:54 +08:00
Inject HEXCLAVE_* env vars in dev environment
`envVarsForProject` only emitted the legacy STACK_* names, while the rest of the CLI (init, doctor, resolveProjectId) uses HEXCLAVE_* as the canonical brand with STACK_* as a fallback. Emit both brands so `hexclave dev` matches that convention. STACK_* output is unchanged and the secret server key is still never exposed under a public framework prefix.
This commit is contained in:
parent
75e497f3ec
commit
2aef5d4b1a
@ -219,21 +219,30 @@ function createInternalApp(apiBaseUrl: string, anonymousRefreshToken?: string) {
|
||||
}
|
||||
|
||||
function envVarsForProject(project: RemoteDevelopmentEnvironmentProject): Record<string, string> {
|
||||
return {
|
||||
STACK_PROJECT_ID: project.projectId,
|
||||
NEXT_PUBLIC_STACK_PROJECT_ID: project.projectId,
|
||||
VITE_STACK_PROJECT_ID: project.projectId,
|
||||
EXPO_PUBLIC_STACK_PROJECT_ID: project.projectId,
|
||||
STACK_PUBLISHABLE_CLIENT_KEY: project.publishableClientKey,
|
||||
NEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY: project.publishableClientKey,
|
||||
VITE_STACK_PUBLISHABLE_CLIENT_KEY: project.publishableClientKey,
|
||||
EXPO_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY: project.publishableClientKey,
|
||||
STACK_SECRET_SERVER_KEY: project.secretServerKey,
|
||||
STACK_API_URL: project.apiBaseUrl,
|
||||
NEXT_PUBLIC_STACK_API_URL: project.apiBaseUrl,
|
||||
VITE_STACK_API_URL: project.apiBaseUrl,
|
||||
EXPO_PUBLIC_STACK_API_URL: project.apiBaseUrl,
|
||||
const brands = ["HEXCLAVE", "STACK"];
|
||||
const publicPrefixes = ["", "NEXT_PUBLIC_", "VITE_", "EXPO_PUBLIC_"];
|
||||
|
||||
const publicValues: Record<string, string> = {
|
||||
PROJECT_ID: project.projectId,
|
||||
PUBLISHABLE_CLIENT_KEY: project.publishableClientKey,
|
||||
API_URL: project.apiBaseUrl,
|
||||
};
|
||||
const secretValues: Record<string, string> = {
|
||||
SECRET_SERVER_KEY: project.secretServerKey,
|
||||
};
|
||||
|
||||
const env: Record<string, string> = {};
|
||||
for (const brand of brands) {
|
||||
for (const [name, value] of Object.entries(publicValues)) {
|
||||
for (const prefix of publicPrefixes) {
|
||||
env[`${prefix}${brand}_${name}`] = value;
|
||||
}
|
||||
}
|
||||
for (const [name, value] of Object.entries(secretValues)) {
|
||||
env[`${brand}_${name}`] = value;
|
||||
}
|
||||
}
|
||||
return env;
|
||||
}
|
||||
|
||||
async function getOrCreateProject(options: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user