wuhp commited on
Commit
6902452
·
verified ·
1 Parent(s): 8b0af6d

Update services/geminiService.ts

Browse files
Files changed (1) hide show
  1. services/geminiService.ts +9 -1
services/geminiService.ts CHANGED
@@ -5,7 +5,15 @@ import { LAYER_DEFINITIONS } from '../constants';
5
 
6
  // Key Management
7
  const getEnvKey = () => {
8
- // 1. Try Vite standard env var (Matches Dockerfile VITE_ prefix)
 
 
 
 
 
 
 
 
9
  // @ts-ignore - import.meta is standard in Vite but TS might complain without config
10
  if (typeof import.meta !== 'undefined' && import.meta.env && import.meta.env.VITE_GEMINI_API_KEY) {
11
  // @ts-ignore
 
5
 
6
  // Key Management
7
  const getEnvKey = () => {
8
+ // STRICT BYOK (Bring Your Own Key) POLICY for Production:
9
+ // We ignore environment variables in production to ensure the host's key isn't leaked/used by public visitors.
10
+ // @ts-ignore
11
+ if (typeof import.meta !== 'undefined' && import.meta.env && import.meta.env.PROD) {
12
+ console.log("Production mode detected: Enforcing BYOK. Environment API keys are ignored.");
13
+ return '';
14
+ }
15
+
16
+ // 1. Try Vite standard env var (Matches Dockerfile VITE_ prefix) - Development Only
17
  // @ts-ignore - import.meta is standard in Vite but TS might complain without config
18
  if (typeof import.meta !== 'undefined' && import.meta.env && import.meta.env.VITE_GEMINI_API_KEY) {
19
  // @ts-ignore