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
()
| 50 | // actually stores its database — notably PAD_DATA_DIR=/data inside the Docker |
| 51 | // image, and non-HOME layouts on Windows. |
| 52 | func 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 |
no test coverage detected