mirror of
https://github.com/tinode/chat.git
synced 2025-03-14 10:05:07 +00:00
tinode-db fixes
This commit is contained in:
@ -50,7 +50,7 @@ func main() {
|
||||
}
|
||||
|
||||
if *conffile != "" {
|
||||
conf, err := ioutil.ReadFile(*datafile)
|
||||
conf, err := ioutil.ReadFile(*conffile)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user