mirror of
https://github.com/charmbracelet/crush.git
synced 2025-08-02 05:20:46 +03:00
chore: pass datadir to db
This commit is contained in:
@@ -76,7 +76,7 @@ to assist developers in writing, debugging, and understanding code directly from
|
||||
cwd = c
|
||||
}
|
||||
|
||||
_, err := config.Init(cwd, debug)
|
||||
cfg, err := config.Init(cwd, debug)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -86,7 +86,7 @@ to assist developers in writing, debugging, and understanding code directly from
|
||||
defer cancel()
|
||||
|
||||
// Connect DB, this will also run migrations
|
||||
conn, err := db.Connect(ctx)
|
||||
conn, err := db.Connect(ctx, cfg.Options.DataDirectory)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -11,13 +11,10 @@ import (
|
||||
_ "github.com/ncruces/go-sqlite3/driver"
|
||||
_ "github.com/ncruces/go-sqlite3/embed"
|
||||
|
||||
"github.com/charmbracelet/crush/internal/config"
|
||||
|
||||
"github.com/pressly/goose/v3"
|
||||
)
|
||||
|
||||
func Connect(ctx context.Context) (*sql.DB, error) {
|
||||
dataDir := config.Get().Options.DataDirectory
|
||||
func Connect(ctx context.Context, dataDir string) (*sql.DB, error) {
|
||||
if dataDir == "" {
|
||||
return nil, fmt.Errorf("data.dir is not set")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user