cmd

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "cmdb-api",
	Short: "资源管理系统",
	Long:  "资源管理系统",
	RunE: func(cmd *cobra.Command, args []string) error {
		if vers {
			fmt.Println(version.FullVersion())
			return nil
		}
		return nil
	},
}

RootCmd represents the base command when called without any subcommands

View Source
var StartCmd = &cobra.Command{
	Use:   "start",
	Short: "启动 cmdb-api",
	Long:  "启动 cmdb-api",
	RunE: func(cmd *cobra.Command, args []string) error {

		err := conf.LoadConfigFromToml(confFile)
		if err != nil {
			return err
		}

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

		apps.InitImpl()

		svc := newManager()
		ch := make(chan os.Signal, 1)
		defer close(ch)

		signal.Notify(ch, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP, syscall.SIGINT)
		go svc.WaitStop(ch)
		return svc.http.Start()
	},
}

程序的启动时 组装都在这里进行

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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