diff --git a/clientdb/account_test.go b/clientdb/account_test.go index c29025d..4f07698 100644 --- a/clientdb/account_test.go +++ b/clientdb/account_test.go @@ -51,7 +51,7 @@ func newTestDB(t *testing.T) (*DB, func()) { t.Fatalf("unable to create temp dir: %v", err) } - db, err := New(tempDir) + db, err := New(tempDir, DBFilename) if err != nil { os.RemoveAll(tempDir) t.Fatalf("unable to create new db: %v", err) diff --git a/clientdb/db.go b/clientdb/db.go index bd77d8c..8d01651 100644 --- a/clientdb/db.go +++ b/clientdb/db.go @@ -9,8 +9,8 @@ import ( ) const ( - // dbFilename is the default filename of the client database. - dbFilename = "pool.db" + // DBFilename is the default filename of the client database. + DBFilename = "pool.db" // dbFilePermission is the default permission the client database file // is created with. @@ -29,9 +29,9 @@ type DB struct { } // New creates a new bolt database that can be found at the given directory. -func New(dir string) (*DB, error) { +func New(dir, fileName string) (*DB, error) { firstInit := false - path := filepath.Join(dir, dbFilename) + path := filepath.Join(dir, fileName) // If the database file does not exist yet, create its directory. if !fileExists(path) { diff --git a/fundingmgr_test.go b/fundingmgr_test.go index 6e764f3..136304d 100644 --- a/fundingmgr_test.go +++ b/fundingmgr_test.go @@ -199,7 +199,7 @@ func newManagerHarness(t *testing.T) *managerHarness { tempDir, err := ioutil.TempDir("", "client-db") require.NoError(t, err) - db, err := clientdb.New(tempDir) + db, err := clientdb.New(tempDir, clientdb.DBFilename) if err != nil { _ = os.RemoveAll(tempDir) t.Fatalf("unable to create new db: %v", err) diff --git a/server.go b/server.go index 16b1618..dc11e39 100644 --- a/server.go +++ b/server.go @@ -378,7 +378,7 @@ func (s *Server) setupClient() error { // Open the main database. var err error - s.db, err = clientdb.New(s.cfg.BaseDir) + s.db, err = clientdb.New(s.cfg.BaseDir, clientdb.DBFilename) if err != nil { return err }