agent

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AgentCmd = &cobra.Command{
	Use:   "agent",
	Short: "start agent",
	Run: func(cmd *cobra.Command, args []string) {
		logging.Info("start agent\n")

		var options Options

		err := utils.Load(configFile, &options)
		if err != nil {
			logging.WithError(err).Warnf("failed to load config file %s, use default", configFile)
		}

		ctx := context.Background()

		stopCh := make(chan os.Signal, 1)
		signal.Notify(stopCh, syscall.SIGTERM, syscall.SIGINT)

		apiController := api.NewRestfulController(options.Agent)
		if apiController == nil {
			logging.Error("cannot create API controller")
			return
		}
		apiController.Start(ctx)

		select {
		case s := <-stopCh:
			logging.Warningf("received signal %v, shutting down ...", s)
		}
		apiController.Stop(ctx)
	},
}

AgentCmd agent command

Functions

This section is empty.

Types

type Options

type Options struct {
	Agent model.RestServiceOptions `json:"agent" yaml:"agent"`
}

Options Options

Jump to

Keyboard shortcuts

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