refactor: reorganize modules and add Linux build tooling
This commit is contained in:
45
module/base/cloud/cmd/main/main.go
Normal file
45
module/base/cloud/cmd/main/main.go
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* @Author: david.yan(david.yan@qq.com)
|
||||
* @Date: 2021-11-26 15:25:03
|
||||
*/
|
||||
package service
|
||||
|
||||
import (
|
||||
"bsm/full/module/base/cloud/internal/config"
|
||||
"bsm/full/module/base/cloud/internal/impl"
|
||||
"bsm/full/module/base/cloud/internal/server"
|
||||
"git.apinb.com/bsm-sdk/core/service"
|
||||
)
|
||||
|
||||
var (
|
||||
ServiceKey = "cloud"
|
||||
)
|
||||
|
||||
func Run() {
|
||||
config.New(ServiceKey)
|
||||
impl.NewImpl()
|
||||
|
||||
// 初始化服务
|
||||
s := server.New(config.Spec.Addr)
|
||||
srv := service.New(
|
||||
s.Grpc,
|
||||
&service.Options{
|
||||
Addr: config.Spec.Addr,
|
||||
MsConf: config.Spec.MicroService,
|
||||
EtcdClient: impl.EtcdService,
|
||||
GatewayCtx: s.Ctx,
|
||||
GatewayConf: config.Spec.Gateway,
|
||||
GatewayMux: s.Mux,
|
||||
},
|
||||
)
|
||||
|
||||
// 停止服务
|
||||
defer srv.Stop()
|
||||
|
||||
// 启动服务
|
||||
srv.Start()
|
||||
}
|
||||
|
||||
func main() {
|
||||
Run()
|
||||
}
|
||||
Reference in New Issue
Block a user