1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Removing debug logging

This commit is contained in:
Patrik J. Braun 2023-07-31 01:29:04 +02:00
parent 6d1b5e21fb
commit 80853771f4
4 changed files with 0 additions and 24 deletions

View File

@ -28,8 +28,6 @@ export class SettingsMWs {
let settings = req.body.settings; // Top level settings JSON let settings = req.body.settings; // Top level settings JSON
const settingsPath: string = req.body.settingsPath; // Name of the top level settings const settingsPath: string = req.body.settingsPath; // Name of the top level settings
const transformer = await Config.original(); const transformer = await Config.original();
console.log('pre settings' + settingsPath);
console.log(settings);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
transformer[settingsPath] = settings; transformer[settingsPath] = settings;
@ -38,29 +36,15 @@ export class SettingsMWs {
settings = ConfigClassBuilder.attachPrivateInterface(transformer[settingsPath]).toJSON({ settings = ConfigClassBuilder.attachPrivateInterface(transformer[settingsPath]).toJSON({
skipTags: {secret: true} as TAGS skipTags: {secret: true} as TAGS
}); });
console.log('post settings'+ settingsPath);
console.log(settings);
const original = await Config.original(); const original = await Config.original();
console.log('orig pre');
console.log(ConfigClassBuilder.attachPrivateInterface(original.Messaging).toJSON());
console.log(original.Messaging.Email);
console.log(original.Messaging.Email.type);
// only updating explicitly set config (not saving config set by the diagnostics) // only updating explicitly set config (not saving config set by the diagnostics)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
original[settingsPath] = settings; original[settingsPath] = settings;
console.log('orig');
console.log(ConfigClassBuilder.attachPrivateInterface(original.Messaging).toJSON());
console.log(original.Messaging.Email);
console.log(original.Messaging.Email.type);
await ConfigDiagnostics.testConfig(original); await ConfigDiagnostics.testConfig(original);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
Config[settingsPath] = settings; Config[settingsPath] = settings;
console.log('Config');
console.log(Config.Messaging);
console.log(Config.Messaging.Email);
console.log(Config.Messaging.Email.type);
await original.save(); await original.save();
await ConfigDiagnostics.runDiagnostics(); await ConfigDiagnostics.runDiagnostics();
Logger.info(LOG_TAG, 'new config:'); Logger.info(LOG_TAG, 'new config:');

View File

@ -82,15 +82,12 @@ export class PrivateConfigClass extends ServerConfig {
require('../../../../package.json').buildCommitHash; require('../../../../package.json').buildCommitHash;
this.Environment.upTime = upTime; this.Environment.upTime = upTime;
this.Environment.isDocker = !!process.env.PI_DOCKER; this.Environment.isDocker = !!process.env.PI_DOCKER;
console.log('CONFIG', ServerEnvironment);
if (typeof ServerEnvironment.sendMailAvailable !== 'undefined') { if (typeof ServerEnvironment.sendMailAvailable !== 'undefined') {
this.Environment.sendMailAvailable = ServerEnvironment.sendMailAvailable; this.Environment.sendMailAvailable = ServerEnvironment.sendMailAvailable;
if (!this.Environment.sendMailAvailable) { //onNewValue is not yet available as a callback if (!this.Environment.sendMailAvailable) { //onNewValue is not yet available as a callback
this.Messaging.Email.type = EmailMessagingType.SMTP; this.Messaging.Email.type = EmailMessagingType.SMTP;
} }
} }
console.log('CONFIG', this.Environment.sendMailAvailable);
console.log('CONFIG', this.Messaging.Email.type);
} }
async original(): Promise<PrivateConfigClass & IConfigClass> { async original(): Promise<PrivateConfigClass & IConfigClass> {

View File

@ -1054,11 +1054,9 @@ export class ServerEnvironmentConfig {
@ConfigProperty<boolean, ServerConfig, TAGS>({ @ConfigProperty<boolean, ServerConfig, TAGS>({
volatile: true, volatile: true,
onNewValue: (value, config) => { onNewValue: (value, config) => {
console.log('onNewValue', value, config.Messaging.Email.type);
if (value === false) { if (value === false) {
config.Messaging.Email.type = EmailMessagingType.SMTP; 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' description: 'App updates on start-up if sendmail binary is available'
}) })

View File

@ -26,7 +26,6 @@ describe('Settings middleware', () => {
}); });
it('should save empty enforced users settings', (done: (err?: any) => void) => { it('should save empty enforced users settings', (done: (err?: any) => void) => {
console.log('sarting - should save empty enforced users settings');
ServerEnvironment.sendMailAvailable = false; ServerEnvironment.sendMailAvailable = false;
Config.Environment.sendMailAvailable = false; Config.Environment.sendMailAvailable = false;
Config.Messaging.Email.type = EmailMessagingType.SMTP; Config.Messaging.Email.type = EmailMessagingType.SMTP;
@ -40,7 +39,6 @@ describe('Settings middleware', () => {
settings: ConfigClassBuilder.attachPrivateInterface(new ServerUserConfig()).toJSON() settings: ConfigClassBuilder.attachPrivateInterface(new ServerUserConfig()).toJSON()
} }
}; };
console.log('Settings', req);
req.body.settings.enforcedUsers = []; req.body.settings.enforcedUsers = [];
const next: any = (err: ErrorDTO) => { const next: any = (err: ErrorDTO) => {
try { try {
@ -57,7 +55,6 @@ describe('Settings middleware', () => {
}); });
it('should save enforced users settings', (done: (err?: any) => void) => { it('should save enforced users settings', (done: (err?: any) => void) => {
console.log('sarting - should save enforced users settings');
ServerEnvironment.sendMailAvailable = false; ServerEnvironment.sendMailAvailable = false;
Config.Environment.sendMailAvailable = false; Config.Environment.sendMailAvailable = false;