From 80689cb3fd281fd3450bd0cc0ebf72e5a6a6103c Mon Sep 17 00:00:00 2001 From: siddontang Date: Wed, 23 Jul 2014 08:01:18 +0800 Subject: [PATCH] fix ledis-repair config error --- cmd/ledis-repair/main.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/ledis-repair/main.go b/cmd/ledis-repair/main.go index 3633ab2..e84ad09 100644 --- a/cmd/ledis-repair/main.go +++ b/cmd/ledis-repair/main.go @@ -3,6 +3,7 @@ package main import ( "encoding/json" "flag" + "github.com/siddontang/copier" "github.com/siddontang/ledisdb/ledis" "github.com/siddontang/ledisdb/leveldb" "io/ioutil" @@ -36,11 +37,13 @@ func main() { return } - if len(cfg.DataDB.Path) == 0 { - cfg.DataDB.Path = path.Join(cfg.DataDir, "data") - } + dbPath := path.Join(cfg.DataDir, "data") - if err = leveldb.Repair(&cfg.DataDB); err != nil { + dbCfg := new(leveldb.Config) + copier.Copy(dbCfg, &cfg.DB) + dbCfg.Path = dbPath + + if err = leveldb.Repair(dbCfg); err != nil { println("repair error: ", err.Error()) } }