diff --git a/src/backend/middlewares/admin/SettingsMWs.ts b/src/backend/middlewares/admin/SettingsMWs.ts index d50fffcd..bfd75f76 100644 --- a/src/backend/middlewares/admin/SettingsMWs.ts +++ b/src/backend/middlewares/admin/SettingsMWs.ts @@ -3,7 +3,6 @@ import {NextFunction, Request, Response} from 'express'; import {ErrorCodes, ErrorDTO} from '../../../common/entities/Error'; import {ObjectManagers} from '../../model/ObjectManagers'; import {Logger} from '../../Logger'; -import {SQLConnection} from '../../model/database/sql/SQLConnection'; import {Config} from '../../../common/config/private/Config'; import {ConfigDiagnostics} from '../../model/diagnostics/ConfigDiagnostics'; import {BasicConfigDTO} from '../../../common/entities/settings/BasicConfigDTO'; @@ -27,7 +26,7 @@ export class SettingsMWs { try { if (databaseSettings.type !== ServerConfig.DatabaseType.memory) { - await SQLConnection.tryConnection(databaseSettings); + await ConfigDiagnostics.testDatabase(databaseSettings); } Config.Server.Database = databaseSettings; // only updating explicitly set config (not saving config set by the diagnostics) diff --git a/src/backend/model/diagnostics/ConfigDiagnostics.ts b/src/backend/model/diagnostics/ConfigDiagnostics.ts index c1d0b0b2..3c12dc59 100644 --- a/src/backend/model/diagnostics/ConfigDiagnostics.ts +++ b/src/backend/model/diagnostics/ConfigDiagnostics.ts @@ -215,14 +215,8 @@ export class ConfigDiagnostics { } catch (ex) { const err: Error = ex; Logger.warn(LOG_TAG, '[SQL error]', err.toString()); - if (Config.Server.Database.enableFallback === true) { - Logger.warn(LOG_TAG, 'Error during initializing SQL falling back temporally to memory DB'); - NotificationManager.warning('Error during initializing SQL falling back temporally to memory DB', err.toString()); - Config.Server.Database.type = ServerConfig.DatabaseType.memory; - } else { - Logger.error(LOG_TAG, 'Error during initializing SQL DB, check DB connection and settings'); - process.exit(1); - } + Logger.error(LOG_TAG, 'Error during initializing SQL DB, check DB connection and settings'); + process.exit(1); } } diff --git a/src/common/config/private/PrivateConfig.ts b/src/common/config/private/PrivateConfig.ts index f8bf2ab8..08a7c5a1 100644 --- a/src/common/config/private/PrivateConfig.ts +++ b/src/common/config/private/PrivateConfig.ts @@ -66,9 +66,6 @@ export module ServerConfig { }) type: DatabaseType = DatabaseType.sqlite; - @ConfigProperty({description: 'In the case of bad database settings (or unreachable database), the app falls back using inmemory database, otherwise terminates the app.'}) - enableFallback: boolean = true; - @ConfigProperty() dbFolder: string = 'db';