mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-02 13:10:55 +00:00
Add backup file ignore list.
This commit is contained in:
parent
e681df1e65
commit
06eda8932a
@ -14,8 +14,10 @@ import java.io.BufferedOutputStream
|
||||
import java.io.FileInputStream
|
||||
import java.io.FileOutputStream
|
||||
import java.io.IOException
|
||||
import java.nio.file.FileSystems
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
import java.nio.file.Paths
|
||||
import java.time.Instant
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
import java.util.zip.ZipEntry
|
||||
@ -119,8 +121,10 @@ class BackupCommand(
|
||||
}
|
||||
|
||||
private fun addDirectoryToZip(zipStream: ZipOutputStream, directoryPath: Path) {
|
||||
val matchers = config.ignore.map { FileSystems.getDefault().getPathMatcher("glob:$it") }
|
||||
val paths = Files.walk(directoryPath)
|
||||
.filter { path: Path? -> Files.isRegularFile(path) }
|
||||
.filter { path: Path -> Files.isRegularFile(path) }
|
||||
.filter { path -> !matchers.any { it.matches(Paths.get(path.normalize().toString())) } }
|
||||
.toList()
|
||||
val buffer = ByteArray(1024)
|
||||
val backupsPath = backupsPath.toRealPath()
|
||||
|
@ -5,6 +5,9 @@ import kotlinx.serialization.Serializable
|
||||
@Serializable
|
||||
data class BackupConfig(
|
||||
val schedule: ScheduleConfig = ScheduleConfig(),
|
||||
val ignore: List<String> = listOf(
|
||||
"plugins/dynmap/web/**"
|
||||
),
|
||||
val s3: S3Config = S3Config(),
|
||||
)
|
||||
|
||||
|
@ -10,6 +10,11 @@ schedule:
|
||||
# "0 3 ? * SUN" -> every Sunday at 3 AM
|
||||
cron: ""
|
||||
|
||||
# List of file patterns to ignore and ignore in the backup.
|
||||
ignore:
|
||||
# Dynmap web output.
|
||||
- "plugins/dynmap/web/**"
|
||||
|
||||
# Configuration of S3 service to upload back-ups to.
|
||||
s3:
|
||||
# The access key ID from your S3-compliant storage provider.
|
||||
|
Loading…
Reference in New Issue
Block a user