mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 首次启动时初始化setting
This commit is contained in:
1 parent
3fc5612ca3
commit
6e0aaf12a3
1 file changed
+4
@@ -1,3 +1,4 @@
|
||||
import { SYSTEM_SETTINGS } from './setting';
|
||||
import { NumberKeys } from '../typeutils';
|
||||
import { SystemKeys } from '../interface';
|
||||
import * as db from '../service/db';
|
||||
@@ -56,6 +57,9 @@ export async function inc<K extends NumberKeys<SystemKeys>>(_id: K) {
|
||||
}
|
||||
|
||||
(async () => {
|
||||
for (const setting of SYSTEM_SETTINGS) {
|
||||
if (setting.value) cache[setting.key] = setting.value;
|
||||
}
|
||||
const config = await coll.find({}).toArray();
|
||||
for (const i of config) cache[i._id] = i.value;
|
||||
bus.emit('database/config');
|
||||
|
||||
Reference in new issue
Block a user