Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Startup ¶
func Startup(components *component.Components, name string)
func WithAppEnv ¶
func serve(c *cli.Context) error { //设置读取的文件类型 viper.SetConfigType("toml") viper.AddConfigPath(c.String("c")) viper.SetConfigName("config.toml") err := viper.ReadInConfig() if err != nil { log.Fatalf("ReadInConfig", err.Error()) } //性能检测 if c.Bool("debug.cpuprofile") { filename := fmt.Sprintf("cpuprofile-%d.pprof", time.Now().Unix()) f, err := os.OpenFile(filename, os.O_WRONLY|os.O_CREATE, os.ModePerm) if err != nil { panic(err) } pprof.StartCPUProfile(f) defer pprof.StopCPUProfile() } components := comps.Comps(NewComponent()) //startup.Startup(components) wg := sync.WaitGroup{} wg.Add(1) go func() { defer wg.Done(); startup.Startup(components) }() wg.Wait() return nil }
AppEnv 为 urfave/cli 方式启动的APP 设置 环境变量 urfave/cli is a declarative, simple, fast, and fun package for building command line tools in Go featuring
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.