fix: ensure database parent directory is always created

This commit is contained in:
Gauthier Roebroeck 2023-08-11 16:59:18 +08:00
parent 32ef331689
commit fdd6fff0ba

View File

@ -1,5 +1,6 @@
package org.gotson.komga.infrastructure.configuration
import jakarta.annotation.PostConstruct
import jakarta.validation.constraints.NotBlank
import jakarta.validation.constraints.Positive
import org.springframework.boot.context.properties.ConfigurationProperties
@ -9,11 +10,21 @@ import org.springframework.validation.annotation.Validated
import org.sqlite.SQLiteConfig.JournalMode
import java.time.Duration
import java.time.temporal.ChronoUnit
import kotlin.io.path.Path
import kotlin.io.path.createDirectories
@Component
@ConfigurationProperties(prefix = "komga")
@Validated
class KomgaProperties {
@PostConstruct
private fun makeDirs() {
try {
Path(database.file).parent.createDirectories()
} catch (_: Exception) {
}
}
var librariesScanCron: String = ""
var librariesScanStartup: Boolean = false