mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08:00
adding config to disable memory db fallback. #163
This commit is contained in:
parent
4cb3a55362
commit
aa2f8451a6
@ -230,9 +230,14 @@ export class ConfigDiagnostics {
|
||||
} catch (ex) {
|
||||
const err: Error = ex;
|
||||
Logger.warn(LOG_TAG, '[SQL error]', err.toString());
|
||||
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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,6 +67,9 @@ 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';
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user