2023-03-03 14:43:11 +01:00
|
|
|
package services
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
|
|
|
"github.com/beego/beego/v2/core/logs"
|
|
|
|
beego "github.com/beego/beego/v2/server/web"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Init() {
|
|
|
|
Discoveryinit() //First init DC name
|
|
|
|
|
|
|
|
var DBpoint string
|
|
|
|
var err error
|
|
|
|
|
2023-10-31 11:23:39 +01:00
|
|
|
|
2023-03-03 14:43:11 +01:00
|
|
|
DBpoint = os.Getenv("DOCKER_DBPOINT")
|
|
|
|
if len(DBpoint) == 0 {
|
|
|
|
DBpoint, err = beego.AppConfig.String("DBPOINT")
|
|
|
|
if err != nil {
|
|
|
|
logs.Critical("DBPOINT URI error: %v", err)
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Mongoinit(DC_NAME + "-" + DBpoint)
|
|
|
|
|
|
|
|
}
|