mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(database): SQLite database backups (#1756)
* feat(database): SQLite database backups * feat(database): do not produce SQL injections * feat(database): retain all backups if 0 or less refactor(database): specify database driver in func names * refactor(database): return early on cleanup * refactor(database): do not call cleanup func if max backups set to 0 * refactor(database): backup retention behavior * feat(database): improve logging --------- Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
This commit is contained in:
parent
1227657ae8
commit
74eea79215
4 changed files with 146 additions and 12 deletions
|
@ -86,6 +86,12 @@ checkForUpdates = true
|
|||
#
|
||||
sessionSecret = "{{ .sessionSecret }}"
|
||||
|
||||
# Database Max Backups
|
||||
#
|
||||
# Default: 5
|
||||
#
|
||||
#databaseMaxBackups = 5
|
||||
|
||||
# Golang pprof profiling and tracing
|
||||
#
|
||||
#profilingEnabled = false
|
||||
|
@ -216,6 +222,7 @@ func (c *AppConfig) defaults() {
|
|||
LogPath: "",
|
||||
LogMaxSize: 50,
|
||||
LogMaxBackups: 3,
|
||||
DatabaseMaxBackups: 5,
|
||||
BaseURL: "/",
|
||||
SessionSecret: api.GenerateSecureToken(16),
|
||||
CustomDefinitions: "",
|
||||
|
@ -293,6 +300,13 @@ func (c *AppConfig) loadFromEnv() {
|
|||
}
|
||||
}
|
||||
|
||||
if v := os.Getenv(prefix + "DATABASE_MAX_BACKUPS"); v != "" {
|
||||
i, _ := strconv.ParseInt(v, 10, 32)
|
||||
if i > 0 {
|
||||
c.Config.DatabaseMaxBackups = int(i)
|
||||
}
|
||||
}
|
||||
|
||||
if v := os.Getenv(prefix + "POSTGRES_HOST"); v != "" {
|
||||
c.Config.PostgresHost = v
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue