-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentry.js
More file actions
33 lines (27 loc) · 764 Bytes
/
entry.js
File metadata and controls
33 lines (27 loc) · 764 Bytes
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
const fs = require('fs');
const os = require('os');
// 设置前端默认值
const frontEnv = {
VITE_DEFAULT_PLACEHOLDER: 'Send a message to AI',
VITE_DEFAULT_BOTTOM_TIPS: '""',
VITE_API_HOST: 'https://api.aios.chat/v1/chat/completions',
VITE_CACHE_TIMES: 100,
VITE_BASE_URL: '/',
VITE_LOGO_URL:'""',
VITE_SUPABASE_URL: 'https://sp-key.aios.chat',
VITE_SUPABASE_KEY: '""'
};
function getEnvString(obj) {
let envString = '';
for (const key in obj) {
if (process.env[key]) {
obj[key] = process.env[key];
}
envString += `${key}=${obj[key]}${os.EOL}`;
}
return envString;
}
const frontEnvString = getEnvString(frontEnv);
if (!fs.existsSync('.env.development')) {
fs.writeFileSync('.env.development', frontEnvString);
}