feat!(config): store sqlite file relative to rootpath (#934)

Moderately breaking change since in most cases the root path was already set next to the binary.
This commit is contained in:
kolaente
2025-06-13 09:16:25 +02:00
committed by GitHub
parent eac6c98bf1
commit 0145a8ba50
2 changed files with 5 additions and 3 deletions

View File

@@ -366,7 +366,7 @@ func InitDefaultConfig() {
DatabaseUser.setDefault("vikunja")
DatabasePassword.setDefault("")
DatabaseDatabase.setDefault("vikunja")
DatabasePath.setDefault("./vikunja.db")
DatabasePath.setDefault(filepath.Join(ServiceRootpath.GetString(), "vikunja.db"))
DatabaseMaxOpenConnections.setDefault(100)
DatabaseMaxIdleConnections.setDefault(50)
DatabaseMaxConnectionLifetime.setDefault(10000)

View File

@@ -20,6 +20,7 @@ import (
"fmt"
"net/url"
"os"
"path/filepath"
"strconv"
"strings"
"time"
@@ -178,8 +179,9 @@ func initPostgresEngine() (engine *xorm.Engine, err error) {
func initSqliteEngine() (engine *xorm.Engine, err error) {
path := config.DatabasePath.GetString()
if path == "" {
path = "./db.db"
if path != "memory" && !filepath.IsAbs(path) {
path = filepath.Join(config.ServiceRootpath.GetString(), path)
}
if path == "memory" {