1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2024-12-23 01:27:14 +02:00

Log Log Log...

This commit is contained in:
Patrik J. Braun 2023-07-30 17:22:47 +02:00
parent 15c79ad68d
commit f007037bc5
4 changed files with 11 additions and 2 deletions

View File

@ -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

View File

@ -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<PrivateConfigClass & IConfigClass> {

View File

@ -1054,9 +1054,11 @@ export class ServerEnvironmentConfig {
@ConfigProperty<boolean, ServerConfig, TAGS>({
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'
})

View File

@ -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: {},