perf: init db and config

This commit is contained in:
archer
2023-07-27 09:33:56 +08:00
parent aa7fb6a65c
commit 97c7984dd1
7 changed files with 74 additions and 19 deletions

View File

@@ -90,7 +90,8 @@ const defaultVectorModels = [
export async function getInitConfig() {
try {
const res = JSON.parse(readFileSync('data/config.json', 'utf-8'));
const filename = process.env.NODE_ENV === 'development' ? 'config.json.local' : 'config.json';
const res = JSON.parse(readFileSync(`data/${filename}`, 'utf-8'));
console.log(res);
global.systemEnv = res.SystemParams || defaultSystemEnv;