diff --git a/server/config/config.go b/server/config/config.go index 49168b7b8..4411acfe4 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -205,8 +205,8 @@ func parseConfig(path string) (*Config, error) { }, DB: DBConfig{ Driver: "sqlite", - DataSource: filepath.Join(dataPath, "soft-serve.db"+ - "?_pragma=busy_timeout(5000)&_pragma=foreign_keys(1)"), + DataSource: "soft-serve.db" + + "?_pragma=busy_timeout(5000)&_pragma=foreign_keys(1)", }, } @@ -335,6 +335,10 @@ func (c *Config) validate() error { c.HTTP.TLSCertPath = filepath.Join(c.DataPath, c.HTTP.TLSCertPath) } + if strings.HasPrefix(c.DB.Driver, "sqlite") && !filepath.IsAbs(c.DB.DataSource) { + c.DB.DataSource = filepath.Join(c.DataPath, c.DB.DataSource) + } + return nil } diff --git a/server/config/file.go b/server/config/file.go index cbdf7daf2..6e67d3714 100644 --- a/server/config/file.go +++ b/server/config/file.go @@ -82,7 +82,7 @@ stats: # The database configuration. db: # The database driver to use. - # Valid values are "sqlite3", "sqlite", "postgres", and "mysql". + # Valid values are "sqlite" and "postgres". driver: "{{ .DB.Driver }}" # The database data source name. # This is driver specific and can be a file path or connection string.