diff --git a/common/redis.go b/common/redis.go index 8b34a083..a46ddf70 100644 --- a/common/redis.go +++ b/common/redis.go @@ -17,9 +17,10 @@ func InitRedisClient() (err error) { SysLog("REDIS_CONN_STRING not set, Redis is not enabled") return nil } + SysLog("Redis is enabled") opt, err := redis.ParseURL(os.Getenv("REDIS_CONN_STRING")) if err != nil { - panic(err) + FatalLog(err) } RDB = redis.NewClient(opt) diff --git a/model/main.go b/model/main.go index 71f3771e..b4932ff5 100644 --- a/model/main.go +++ b/model/main.go @@ -42,17 +42,19 @@ func InitDB() (err error) { var db *gorm.DB if os.Getenv("SQL_DSN") != "" { // Use MySQL + common.SysLog("using MySQL as database") db, err = gorm.Open(mysql.Open(os.Getenv("SQL_DSN")), &gorm.Config{ PrepareStmt: true, // precompile SQL }) } else { // Use SQLite + common.SysLog("SQL_DSN not set, using SQLite as database") common.UsingSQLite = true db, err = gorm.Open(sqlite.Open(common.SQLitePath), &gorm.Config{ PrepareStmt: true, // precompile SQL }) - common.SysLog("SQL_DSN not set, using SQLite as database") } + common.SysLog("Database connected") if err == nil { DB = db if !common.IsMasterNode { @@ -86,6 +88,7 @@ func InitDB() (err error) { if err != nil { return err } + common.SysLog("Database migrated") err = createRootAccountIfNeed() return err } else {