This commit is contained in:
binwiederhier
2026-02-22 20:39:41 -05:00
parent 850a9d4cc4
commit 811c7ae25a
2 changed files with 14 additions and 2 deletions

View File

@@ -2,8 +2,12 @@ package user
import (
"database/sql"
"fmt"
"path/filepath"
_ "github.com/mattn/go-sqlite3" // SQLite driver
"heckel.io/ntfy/v2/util"
)
const (
@@ -200,6 +204,10 @@ const (
// NewSQLiteStore creates a new SQLite-backed user store
func NewSQLiteStore(filename, startupQueries string) (Store, error) {
parentDir := filepath.Dir(filename)
if !util.FileExists(parentDir) {
return nil, fmt.Errorf("user database directory %s does not exist or is not accessible", parentDir)
}
db, err := sql.Open("sqlite3", filename)
if err != nil {
return nil, err