mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: fix types
This commit is contained in:
1 parent
d27a1499d2
commit
1c3dc161b6
13 files changed
+48
-62
No files matched your search
@@ -2,7 +2,6 @@ import yaml from 'js-yaml';
|
||||
import { nanoid } from 'nanoid';
|
||||
import Schema from 'schemastery';
|
||||
import { Logger } from './logger';
|
||||
import * as bus from './service/bus';
|
||||
import { NestKeys } from './typeutils';
|
||||
|
||||
const defaultPath = process.env.CI ? '/tmp/file'
|
||||
@@ -64,7 +63,7 @@ export async function saveConfig(config: any) {
|
||||
Schema.intersect(SystemSettings)(config);
|
||||
const value = yaml.dump(config);
|
||||
await global.Hydro.service.db.collection('system').updateOne({ _id: 'config' }, { $set: { value } }, { upsert: true });
|
||||
bus.broadcast('config/update');
|
||||
loadConfig();
|
||||
}
|
||||
export async function setConfig(key: string, value: any) {
|
||||
const path = key.split('.');
|
||||
@@ -109,5 +108,3 @@ export function requestConfig<T, S>(s: Schema<T, S>): {
|
||||
const builtin = requestConfig(builtinSettings);
|
||||
export const builtinConfig = builtin.config;
|
||||
export const setBuiltinConfig = builtin.setConfig;
|
||||
|
||||
bus.on('config/update', loadConfig);
|
||||
Reference in new issue
Block a user