Support environment variable VESPA_KEEP_FILE_REFERENCES_DAYS
@@ -42,7 +42,7 @@ class FileReferencesAndDownloadsMaintainer implements Runnable {
private final Duration durationToKeepFiles;
FileReferencesAndDownloadsMaintainer() {
- this(defaultFileReferencesDownloadDir, defaultUrlDownloadDir, defaultDurationToKeepFiles);
+ this(defaultFileReferencesDownloadDir, defaultUrlDownloadDir, keepFileReferencesDuration());
}
FileReferencesAndDownloadsMaintainer(File fileReferencesDownloadDir, File urlDownloadDir, Duration durationToKeepFiles) {
@@ -104,4 +104,12 @@ class FileReferencesAndDownloadsMaintainer implements Runnable {
}
}
+ private static Duration keepFileReferencesDuration() {
+ String env = System.getenv("VESPA_KEEP_FILE_REFERENCES_DAYS");
+ if (env != null && !env.isEmpty())
+ return Duration.ofDays(Integer.parseInt(env));
+ else
+ return defaultDurationToKeepFiles;
+ }
+
}
