diff --git a/src/backend/middlewares/admin/SettingsMWs.ts b/src/backend/middlewares/admin/SettingsMWs.ts index 2a8ef6a4..ee70b105 100644 --- a/src/backend/middlewares/admin/SettingsMWs.ts +++ b/src/backend/middlewares/admin/SettingsMWs.ts @@ -27,8 +27,9 @@ export class SettingsMWs { try { let settings = req.body.settings; // Top level settings JSON const settingsPath: string = req.body.settingsPath; // Name of the top level settings - const transformer = await Config.original(); + console.log('pre settings'); + console.log(settings); // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore transformer[settingsPath] = settings; @@ -37,6 +38,8 @@ export class SettingsMWs { settings = ConfigClassBuilder.attachPrivateInterface(transformer[settingsPath]).toJSON({ skipTags: {secret: true} as TAGS }); + console.log('post settings'); + console.log(settings); const original = await Config.original(); // only updating explicitly set config (not saving config set by the diagnostics) // eslint-disable-next-line @typescript-eslint/ban-ts-comment diff --git a/src/common/config/private/Config.ts b/src/common/config/private/Config.ts index 00cda39e..b7f980d8 100644 --- a/src/common/config/private/Config.ts +++ b/src/common/config/private/Config.ts @@ -81,12 +81,15 @@ export class PrivateConfigClass extends ServerConfig { require('../../../../package.json').buildCommitHash; this.Environment.upTime = upTime; this.Environment.isDocker = !!process.env.PI_DOCKER; + console.log('CONFIG', ServerEnvironment); if (typeof ServerEnvironment.sendMailAvailable !== 'undefined') { this.Environment.sendMailAvailable = ServerEnvironment.sendMailAvailable; if(!this.Environment.sendMailAvailable){ //onNewValue is not yet available as a callback this.Messaging.Email.type = EmailMessagingType.SMTP; } } + console.log('CONFIG', this.Environment.sendMailAvailable); + console.log('CONFIG', this.Messaging.Email.type); } async original(): Promise { diff --git a/src/common/config/private/PrivateConfig.ts b/src/common/config/private/PrivateConfig.ts index e9b60a19..ffd81878 100644 --- a/src/common/config/private/PrivateConfig.ts +++ b/src/common/config/private/PrivateConfig.ts @@ -1054,9 +1054,11 @@ export class ServerEnvironmentConfig { @ConfigProperty({ volatile: true, onNewValue: (value, config) => { + console.log('onNewValue', value, config.Messaging.Email.type); if (value === false) { config.Messaging.Email.type = EmailMessagingType.SMTP; } + console.log('onNewValue after', value, config.Messaging.Email.type); }, description: 'App updates on start-up if sendmail binary is available' }) diff --git a/test/backend/unit/middlewares/admin/SettingsMWs.ts b/test/backend/unit/middlewares/admin/SettingsMWs.ts index 8a759748..0abc961a 100644 --- a/test/backend/unit/middlewares/admin/SettingsMWs.ts +++ b/test/backend/unit/middlewares/admin/SettingsMWs.ts @@ -36,6 +36,7 @@ describe('Settings middleware', () => { settings: ConfigClassBuilder.attachPrivateInterface(new ServerUserConfig()).toJSON() } }; + console.log('Settings', req); req.body.settings.enforcedUsers = []; const next: any = (err: ErrorDTO) => { try { @@ -55,7 +56,7 @@ describe('Settings middleware', () => { ServerEnvironment.sendMailAvailable = false; Config.Environment.sendMailAvailable = false - Config.Messaging.Email.type = EmailMessagingType.sendmail;; + Config.Messaging.Email.type = EmailMessagingType.sendmail; const req: any = { session: {}, sessionOptions: {},