package main import ( "flag" "fmt" "git.nobla.cn/golang/kos" "git.nobla.cn/golang/moto" "git.nobla.cn/golang/moto/config" "git.nobla.cn/golang/moto/version" yaml "gopkg.in/yaml.v3" "os" ) var ( configFlag = flag.String("config", "", "Config filename") ) func main() { var ( buf []byte err error ) flag.Parse() cfg := config.New() if *configFlag != "" { if buf, err = os.ReadFile(*configFlag); err != nil { fmt.Println(err.Error()) os.Exit(1) } if err = yaml.Unmarshal(buf, cfg); err != nil { fmt.Println(err.Error()) os.Exit(1) } } svr := kos.Init( kos.WithName("git.nobla.cn/golang/"+version.ProductName, version.Version), kos.WithServer(moto.New(cfg)), ) if err = svr.Run(); err != nil { fmt.Println(err) os.Exit(1) } }