MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / resolveSQLiteDBPath

Function resolveSQLiteDBPath

cmd/pad/cmd_db.go:52–58  ·  view source on GitHub ↗

resolveSQLiteDBPath returns the SQLite database path using the SAME precedence the server uses (PAD_DB_PATH > PAD_DATA_DIR/pad.db > ~/.pad/pad.db), via the shared config loader rather than a hardcoded HOME path. This keeps the backup/restore/migrate commands in sync with wherever the server actually

()

Source from the content-addressed store, hash-verified

50// actually stores its database — notably PAD_DATA_DIR=/data inside the Docker
51// image, and non-HOME layouts on Windows.
52func resolveSQLiteDBPath() (string, error) {
53 cfg, err := config.Load()
54 if err != nil {
55 return "", fmt.Errorf("load config: %w", err)
56 }
57 return cfg.DBPath, nil
58}
59
60// backupSQLite writes an online-safe, self-contained copy of the SQLite
61// database at srcPath to outPath using `VACUUM INTO`. Unlike an io.Copy of the

Callers 2

dbBackupCmdFunction · 0.85
dbMigrateToPgCmdFunction · 0.85

Calls 1

LoadFunction · 0.92

Tested by

no test coverage detected