deprecated-oc-catalog/services/init.go

45 lines
776 B
Go

package services
import (
"cloud.o-forge.io/core/oc-catalog/conf"
"github.com/beego/beego/v2/core/logs"
)
func Init() {
// Discoveryinit() //First init DC name
config := conf.GetConfig()
var DBpoint string
var DC_NAME string
var err error
DC_NAME = config.DCNAME
if len(DC_NAME) == 0 {
logs.Critical("DC_NAME URI error: %v", err)
panic(err)
}
DBpoint = config.DBPOINT
if len(DBpoint) == 0 {
logs.Critical("DBPOINT URI error: %v", err)
panic(err)
}
// if len(DBpoint) == 0 {
// DBpoint, err = beego.AppConfig.String("DBPOINT")
// if err != nil {
// logs.Critical("DBPOINT URI error: %v", err)
// panic(err)
// }
// }
logs.Debug("connecting to datacenter db : " + DC_NAME + "-" + DBpoint)
Mongoinit(DC_NAME + "-" + DBpoint)
}