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

fixing temp folder saving #311

This commit is contained in:
Patrik J. Braun 2021-06-19 12:18:07 +02:00
parent 74a56caf76
commit 41975f72a1

View File

@ -10,6 +10,7 @@ import {OtherConfigDTO} from '../../../common/entities/settings/OtherConfigDTO';
import {ProjectPath} from '../../ProjectPath'; import {ProjectPath} from '../../ProjectPath';
import { import {
DatabaseType, DatabaseType,
IPrivateConfig,
ServerDataBaseConfig, ServerDataBaseConfig,
ServerIndexingConfig, ServerIndexingConfig,
ServerJobConfig, ServerJobConfig,
@ -387,22 +388,19 @@ export class SettingsMWs {
try { try {
const settings: BasicConfigDTO = req.body.settings; const settings: BasicConfigDTO = req.body.settings;
await ConfigDiagnostics.testImageFolder(settings.imagesFolder); await ConfigDiagnostics.testImageFolder(settings.imagesFolder);
Config.Server.port = settings.port; const map = (config: IPrivateConfig, input: BasicConfigDTO) => {
Config.Server.host = settings.host; config.Server.port = input.port;
Config.Server.Media.folder = settings.imagesFolder; config.Server.host = input.host;
Config.Server.Media.tempFolder = settings.tempFolder; config.Server.Media.folder = input.imagesFolder;
Config.Client.publicUrl = settings.publicUrl; config.Server.Media.tempFolder = input.tempFolder;
Config.Client.urlBase = settings.urlBase; config.Client.publicUrl = input.publicUrl;
Config.Client.applicationTitle = settings.applicationTitle; config.Client.urlBase = input.urlBase;
config.Client.applicationTitle = input.applicationTitle;
};
map(Config, settings);
// only updating explicitly set config (not saving config set by the diagnostics) // only updating explicitly set config (not saving config set by the diagnostics)
const original = await Config.original(); const original = await Config.original();
original.Server.port = settings.port; map(original, settings);
original.Server.host = settings.host;
original.Server.Media.folder = settings.imagesFolder;
original.Server.Media.folder = settings.tempFolder;
original.Client.publicUrl = settings.publicUrl;
original.Client.urlBase = settings.urlBase;
original.Client.applicationTitle = settings.applicationTitle;
original.save(); original.save();
ProjectPath.reset(); ProjectPath.reset();
await ConfigDiagnostics.runDiagnostics(); await ConfigDiagnostics.runDiagnostics();