Merge pull request #533 from sgotti/services_config_check_valid_sqlite3_db_connstring

services/config: check valid sqlite3 db connstring
This commit is contained in:
Simone Gotti 2024-08-21 18:13:10 +02:00 committed by GitHub
commit babcd6a6fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 0 deletions

View File

@ -16,6 +16,7 @@ package config
import ( import (
"os" "os"
"path/filepath"
"slices" "slices"
"time" "time"
@ -514,6 +515,12 @@ func validateDB(db *DB) error {
return errors.Errorf("db connection string undefined") return errors.Errorf("db connection string undefined")
} }
if db.Type == sql.Sqlite3 {
if !filepath.IsAbs(db.ConnString) {
return errors.Errorf("sqlite3 db connection string must be an absolute path")
}
}
return nil return nil
} }