MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / loadConfig

Method loadConfig

packages/hydrooj/src/settings.ts:57–70  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55 }
56
57 async loadConfig() {
58 const config = await this.ctx.db.collection('system').findOne({ _id: 'config' }, {
59 readPreference: 'primary', readConcern: 'majority',
60 });
61 try {
62 this.configSource = config?.value || '{}';
63 this.systemConfig = yaml.load(this.configSource);
64 this._applySchema();
65 this.ctx.emit('system/setting', { config: this.configSource });
66 logger.info('Successfully loaded config');
67 } catch (e) {
68 logger.error('Failed to load config', e.message);
69 }
70 }
71
72 applyDelta(source: any, key: string, value: any) {
73 const path = key.split('.');

Callers 2

[Service.init]Method · 0.95
saveConfigMethod · 0.95

Calls 5

_applySchemaMethod · 0.95
collectionMethod · 0.80
loadMethod · 0.45
infoMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected