cmd

package
v0.0.0-...-297105b Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

@Author: Ciusyan 2023/1/24

@Author: Ciusyan 2023/1/24

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:     "Dousheng",
	Long:    "dousheng API",
	Short:   "dusheng API",
	Example: "dousheng cmd",
	RunE: func(cmd *cobra.Command, args []string) error {
		if vers {
			fmt.Println(version.FullVersion())
		}
		return nil
	},
}
View Source
var StartCmd = &cobra.Command{
	Use:     "start",
	Long:    "启动 Dousheng API服务",
	Short:   "启动 Dousheng API服务",
	Example: "go run main start",
	RunE: func(cmd *cobra.Command, args []string) error {

		if err := conf.LoadConfigFromToml(configFile); err != nil {
			return err
		}
		if err := loadGlobalLogger(); err != nil {
			return err
		}

		apps.InitService()

		manager := NewManager()

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

		signal.Notify(ch, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP, syscall.SIGINT)

		go manager.WaitStop(ch)

		return manager.Start()
	},
}

Functions

func NewManager

func NewManager() *manager

Types

This section is empty.

Jump to

Keyboard shortcuts

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