Skip to content

Commit a772967

Browse files
committed
Remove frontend secret injection and document env safety
1 parent cf4b341 commit a772967

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ The project uses the following tables in Supabase:
104104
VITE_SUPABASE_ANON_KEY=your_supabase_anon_key
105105
```
106106

107+
- [ ] Never expose non-`VITE_` secrets to frontend bundle
108+
109+
107110
4. **Run the development server**
108111
```bash
109112
npm run dev

api/wakatime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default async function handler(req, res) {
2-
const apiKey = process.env.WAKATIME_API_KEY || process.env.VITE_WAKATIME_API_KEY;
2+
const apiKey = process.env.WAKATIME_API_KEY;
33

44
if (!apiKey) {
55
return res.status(500).json({ error: 'Server Configuration Error: Missing API Key' });

vite.config.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
import path from 'path';
2-
import { defineConfig, loadEnv } from 'vite';
2+
import { defineConfig } from 'vite';
33
import react from '@vitejs/plugin-react';
44

5-
export default defineConfig(({ mode }) => {
6-
const env = loadEnv(mode, process.cwd(), '');
5+
export default defineConfig(() => {
76
return {
87
server: {
98
port: 3000,
109
host: '0.0.0.0',
1110
},
1211
plugins: [react()],
13-
define: {
14-
'process.env.API_KEY': JSON.stringify(env.GEMINI_API_KEY),
15-
'process.env.GEMINI_API_KEY': JSON.stringify(env.GEMINI_API_KEY)
16-
},
1712
resolve: {
1813
alias: {
1914
'@': path.resolve(__dirname, '.'),

0 commit comments

Comments
 (0)