Wire PUBLIC_LLAMA_CLOUD_API_KEY through template Vite configs (#273)

Read the opt-in PUBLIC_LLAMA_CLOUD_API_KEY env var and re-export as
import.meta.env.VITE_LLAMA_CLOUD_API_KEY for the 5 llama_cloud=true UIs.
Server-only LLAMA_CLOUD_API_KEY is no longer the source for client bundles;
deployers must explicitly opt in by setting PUBLIC_*.
This commit is contained in:
Adrian Lyjak
2026-04-25 11:39:28 -04:00
committed by GitHub
parent a3d9b8ae8f
commit dafdbc74aa
+4
View File
@@ -10,6 +10,7 @@ export default defineConfig(({}) => {
const port = process.env.PORT ? Number(process.env.PORT) : 3000;
const serverPort = process.env.LLAMA_DEPLOY_SERVER_PORT;
const baseUrl = process.env.LLAMA_CLOUD_BASE_URL;
const apiKey = process.env.PUBLIC_LLAMA_CLOUD_API_KEY;
return {
plugins: [react()],
resolve: {
@@ -43,6 +44,9 @@ export default defineConfig(({}) => {
...(baseUrl && {
"import.meta.env.VITE_LLAMA_CLOUD_BASE_URL": JSON.stringify(baseUrl),
}),
...(apiKey && {
"import.meta.env.VITE_LLAMA_CLOUD_API_KEY": JSON.stringify(apiKey),
}),
},
};
});