()
| 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('.'); |
no test coverage detected