cmd

package
v0.0.0-...-19fd678 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "demo-api",
	Short: "demo-backend-api",
	Long:  "demo-backend-api",
	RunE: func(cmd *cobra.Command, args []string) error {
		if vers {
			fmt.Println(version.FullVersion())
			return nil
		}
		return nil
	},
}
View Source
var StartCmd = &cobra.Command{
	Use:   "start",
	Short: "启动API",
	Long:  "启动API",
	RunE: func(cmd *cobra.Command, args []string) error {

		err := conf.LoadConfigFromToml(confFile)

		if err = LoadGlobalLogger(); err != nil {
			return err
		}

		if err != nil {
			return err
		}

		err = zap.DevelopmentSetup()
		if err != nil {
			return err
		}

		apps.InitImpl()

		svc := core.NewManager()

		go svc.WaitStop()

		return svc.Start()
	},
}

StartCmd 通过cli方式将服务启动起来

Functions

func LoadGlobalLogger

func LoadGlobalLogger() error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL