refactor: centralize protobuf and remove go-zero
This commit is contained in:
@@ -1,29 +1,21 @@
|
||||
package impl
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"bsm/full/module/ec/delivery/internal/config"
|
||||
|
||||
"git.apinb.com/bsm-sdk/engine/service"
|
||||
)
|
||||
|
||||
var (
|
||||
Configure config.Config
|
||||
)
|
||||
|
||||
func NewService(srvKey string) {
|
||||
// register service
|
||||
service.Register(srvKey, &Configure)
|
||||
service.RegisterAnonymous(&Configure.RpcServerConf, &Configure.Anonymous)
|
||||
|
||||
service.Start(Configure.ListenOn)
|
||||
|
||||
// with activating
|
||||
withModel() // model
|
||||
withMemCache() // mem cache
|
||||
withRedisCache() // redis cache
|
||||
withPulsar() // mq - pulsar
|
||||
|
||||
// service done.
|
||||
service.Done(&Configure.Prometheus, &Configure.Telemetry)
|
||||
var Configure config.Config
|
||||
|
||||
func NewService(serviceKey string) error {
|
||||
cfg, err := config.Load(serviceKey)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
Configure = cfg
|
||||
if err := withModel(); err != nil {
|
||||
return fmt.Errorf("initialize model: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user