go_dreamfactory/services/worker/main.go
2022-05-27 17:27:01 +08:00

41 lines
688 B
Go

package main
import (
"flag"
"go_dreamfactory/services"
"github.com/liwei1dao/lego"
"github.com/liwei1dao/lego/base/cluster"
"github.com/liwei1dao/lego/core"
)
var (
conf = flag.String("conf", "./conf/worker.yaml", "获取需要启动的服务配置文件") //启动服务的Id
)
func main() {
flag.Parse()
s := NewService(
cluster.SetConfPath(*conf),
cluster.SetVersion("1.0.0.0"),
)
s.OnInstallComp( //装备组件
)
lego.Run(s) //运行模块
}
func NewService(ops ...cluster.Option) core.IService {
s := new(Service)
s.Configure(ops...)
return s
}
type Service struct {
services.ServiceBase
}
func (this *Service) InitSys() {
this.ServiceBase.InitSys()
}