tinode-db fixes

This commit is contained in:
Gene Sokolov
2015-10-29 11:26:58 -07:00
parent 46b5309e02
commit 288c053042
2 changed files with 10 additions and 5 deletions

View File

@ -50,7 +50,7 @@ func main() {
}
if *conffile != "" {
conf, err := ioutil.ReadFile(*datafile)
conf, err := ioutil.ReadFile(*conffile)
if err != nil {
log.Fatal(err)
}

View File

@ -6,6 +6,7 @@ import (
"github.com/tinode/chat/server/store/types"
"log"
"math/rand"
"strings"
"time"
)
@ -24,11 +25,15 @@ func gen_rethink(reset bool, dbsource string, data *Data) {
err = store.InitDb(reset)
if err != nil {
log.Fatal("Failed to init DB: ", err)
if strings.Contains(err.Error(), " already exists") {
log.Println("DB already exists, NOT reinitializing")
} else {
log.Fatal("Failed to init DB: ", err)
}
} else {
log.Println("DB successfully initialized")
}
log.Println("DB successfully initialized")
if data.Users == nil {
log.Println("No data provided, stopping")
return