1 Star 0 Fork 33

Victor_Chou/baetyl-cloud

forked from baetyl/baetyl-cloud 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 1.80 KB
一键复制 编辑 原始数据 按行查看 历史
zhaoxin 提交于 2020-09-17 14:57 . remove env port (#104)
package main
import (
"runtime"
"github.com/baetyl/baetyl-go/v2/context"
"github.com/baetyl/baetyl-go/v2/log"
"github.com/baetyl/baetyl-cloud/v2/api"
"github.com/baetyl/baetyl-cloud/v2/common"
"github.com/baetyl/baetyl-cloud/v2/config"
"github.com/baetyl/baetyl-cloud/v2/plugin"
"github.com/baetyl/baetyl-cloud/v2/server"
_ "github.com/go-sql-driver/mysql"
_ "github.com/baetyl/baetyl-cloud/v2/plugin/awss3"
_ "github.com/baetyl/baetyl-cloud/v2/plugin/database"
_ "github.com/baetyl/baetyl-cloud/v2/plugin/default/auth"
_ "github.com/baetyl/baetyl-cloud/v2/plugin/default/license"
_ "github.com/baetyl/baetyl-cloud/v2/plugin/default/pki"
_ "github.com/baetyl/baetyl-cloud/v2/plugin/kube"
_ "github.com/baetyl/baetyl-cloud/v2/plugin/link/httplink"
)
func main() {
defer plugin.ClosePlugins()
runtime.GOMAXPROCS(runtime.NumCPU())
context.Run(func(ctx context.Context) error {
var cfg config.CloudConfig
err := ctx.LoadCustomConfig(&cfg)
if err != nil {
return err
}
ctx.Log().Debug("cloud config", log.Any("cfg", cfg))
common.SetConfFile(ctx.ConfFile())
a, err := api.NewAPI(&cfg)
if err != nil {
return err
}
sa, err := api.NewSyncAPI(&cfg)
if err != nil {
return err
}
ia, err := api.NewInitAPI(&cfg)
if err != nil {
return err
}
s, err := server.NewAdminServer(&cfg)
if err != nil {
return err
}
s.SetAPI(a)
s.InitRoute()
go s.Run()
defer s.Close()
ctx.Log().Info("admin server starting")
ss, err := server.NewSyncServer(&cfg)
if err != nil {
return err
}
ss.SetSyncAPI(sa)
ss.InitMsgRouter()
ss.Run()
defer ss.Close()
as, err := server.NewInitServer(&cfg)
if err != nil {
return err
}
as.SetAPI(ia)
as.InitRoute()
go as.Run()
defer as.Close()
ctx.Log().Info("init server starting")
ctx.Wait()
return nil
})
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/victor-zhou/baetyl-cloud.git
[email protected]:victor-zhou/baetyl-cloud.git
victor-zhou
baetyl-cloud
baetyl-cloud
master

搜索帮助