forked from Coder-s-OG-s/Global_Notes-workspace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate-config.js
More file actions
37 lines (32 loc) · 1.03 KB
/
generate-config.js
File metadata and controls
37 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const fs = require('fs');
const path = require('path');
// Simple .env parser for local development
const envPath = path.join(__dirname, '.env');
if (fs.existsSync(envPath)) {
const envConfig = fs.readFileSync(envPath, 'utf8');
envConfig.split('\n').forEach(line => {
const [key, value] = line.split('=');
if (key && value) {
process.env[key.trim()] = value.trim();
}
});
}
const configContent = `const config = {
SUPABASE_URL: '${process.env.SUPABASE_URL || ""}',
SUPABASE_ANON_KEY: '${process.env.SUPABASE_ANON_KEY || ""}',
GEMINI_API_KEY: '${process.env.GEMINI_API_KEY || ""}'
};
export default config;
`;
const jsDir = path.join(__dirname, 'JS');
if (!fs.existsSync(jsDir)) {
fs.mkdirSync(jsDir, { recursive: true });
}
const configPath = path.join(jsDir, 'config.js');
try {
fs.writeFileSync(configPath, configContent);
console.log('Successfully generated JS/config.js');
} catch (error) {
console.error('Error generating configuration:', error);
process.exit(1);
}