@ -17,6 +17,7 @@ import { BadRequestException, ForbiddenException, Injectable } from '@nestjs/com
import { CronExpression } from '@nestjs/schedule' ;
import { CronExpression } from '@nestjs/schedule' ;
import { plainToInstance } from 'class-transformer' ;
import { plainToInstance } from 'class-transformer' ;
import { validate } from 'class-validator' ;
import { validate } from 'class-validator' ;
import { load as loadYaml } from 'js-yaml' ;
import * as _ from 'lodash' ;
import * as _ from 'lodash' ;
import { Subject } from 'rxjs' ;
import { Subject } from 'rxjs' ;
import { QueueName } from '../job/job.constants' ;
import { QueueName } from '../job/job.constants' ;
@ -341,19 +342,19 @@ export class SystemConfigCore {
if ( force || ! this . configCache ) {
if ( force || ! this . configCache ) {
try {
try {
const file = await this . repository . readFile ( filepath ) ;
const file = await this . repository . readFile ( filepath ) ;
const json = JSON . parse ( file . toString ( ) ) ;
const config = loadYaml ( file . toString ( ) ) as any ;
const overrides : SystemConfigEntity < SystemConfigValue > [ ] = [ ] ;
const overrides : SystemConfigEntity < SystemConfigValue > [ ] = [ ] ;
for ( const key of Object . values ( SystemConfigKey ) ) {
for ( const key of Object . values ( SystemConfigKey ) ) {
const value = _ . get ( json , key ) ;
const value = _ . get ( config , key ) ;
this . unsetDeep ( json , key ) ;
this . unsetDeep ( config , key ) ;
if ( value !== undefined ) {
if ( value !== undefined ) {
overrides . push ( { key , value } ) ;
overrides . push ( { key , value } ) ;
}
}
}
}
if ( ! _ . isEmpty ( json ) ) {
if ( ! _ . isEmpty ( config ) ) {
this . logger . warn ( ` Unknown keys found: ${ JSON . stringify ( json , null , 2 ) } ` ) ;
this . logger . warn ( ` Unknown keys found: ${ JSON . stringify ( config , null , 2 ) } ` ) ;
}
}
this . configCache = overrides ;
this . configCache = overrides ;