feat(database): make backup schedule configurable via system keys (#4251)

This commit is contained in:
Ludy
2025-09-04 15:02:31 +01:00
committed by GitHub
parent 528968bfe9
commit 8113728d3d
4 changed files with 10 additions and 2 deletions
@@ -329,12 +329,18 @@ public class ApplicationProperties {
private CustomPaths customPaths = new CustomPaths();
private String fileUploadLimit;
private TempFileManagement tempFileManagement = new TempFileManagement();
private DatabaseBackup databaseBackup = new DatabaseBackup();
public boolean isAnalyticsEnabled() {
return this.getEnableAnalytics() != null && this.getEnableAnalytics();
}
}
@Data
public static class DatabaseBackup {
private String cron = "0 0 0 * * ?"; // daily at midnight
}
@Data
public static class CustomPaths {
private Pipeline pipeline = new Pipeline();
@@ -151,6 +151,8 @@ system:
cleanupIntervalMinutes: 30 # How often to run cleanup (in minutes)
startupCleanup: true # Clean up old temp files on startup
cleanupSystemTemp: false # Whether to clean broader system temp directory
databaseBackup:
cron: '0 0 0 * * ?' # Cron expression for automatic database backups "0 0 0 * * ?" daily at midnight
ui:
appName: '' # application's visible name
@@ -18,7 +18,7 @@ public class ScheduledTasks {
private final DatabaseServiceInterface databaseService;
@Scheduled(cron = "0 0 0 * * ?")
@Scheduled(cron = "#{applicationProperties.system.databaseBackup.cron}")
public void performBackup() throws SQLException, UnsupportedProviderException {
databaseService.exportDatabase();
}