package main import ( "oc-discovery/models" _ "oc-discovery/routers" oclib "cloud.o-forge.io/core/oc-lib" "cloud.o-forge.io/core/oc-lib/logs" "cloud.o-forge.io/core/oc-lib/tools" beego "github.com/beego/beego/v2/server/web" ) const appname = "oc-discovery" func main() { // Init the oc-lib oclib.Init(appname, "", "") // get the right config file o := tools.GetConfLoader() models.GetConfig().Port = o.GetIntDefault("port", 8080) models.GetConfig().LokiUrl = o.GetStringDefault("lokiurl", "") models.GetConfig().RedisUrl = o.GetStringDefault("redisurl", "localhost:6379") models.GetConfig().RedisPassword = o.GetStringDefault("redispassword", "") models.GetConfig().ZincUrl = o.GetStringDefault("zincurl", "http://localhost:4080") models.GetConfig().ZincLogin = o.GetStringDefault("zinclogin", "admin") models.GetConfig().ZincPassword = o.GetStringDefault("zincpassword", "admin") models.GetConfig().IdentityFile = o.GetStringDefault("identityfile", "./identity.json") models.GetConfig().Defaultpeers = o.GetStringDefault("defaultpeers", "./peers.json") // set oc-lib logger if models.GetConfig().LokiUrl != "" { logs.CreateLogger(appname, models.GetConfig().LokiUrl) } // Normal beego init beego.BConfig.AppName = appname beego.BConfig.Listen.HTTPPort = models.GetConfig().Port beego.BConfig.WebConfig.DirectoryIndex = true beego.BConfig.WebConfig.StaticDir["/swagger"] = "swagger" beego.Run() }