cmd

package
v0.0.0-...-5e6154d Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2020 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "jerem",
	Short: "Jerem bring observability to Jira",
	Run: func(cmd *cobra.Command, args []string) {
		config, err := core.LoadConfig()
		if err != nil {
			log.WithError(err).Fatal("Fail to load config")
		}

		go func() {
			e := echo.New()
			e.HideBanner = true
			address := viper.GetString("api.listen")
			e.GET("/health", func(c echo.Context) error {
				return c.NoContent(http.StatusOK)
			})

			err := e.Start(address)
			if err != nil && err != http.ErrServerClosed {
				log.WithError(err).Error("cannot start HTTP server")
			}
		}()

		epicRunner := core.NewRunner(func() {
			runner.EpicRunner(config)
		}, viper.GetDuration("runner.period")+1*time.Second)

		sprintRunner := core.NewRunner(func() {
			runner.SprintRunner(config)
		}, viper.GetDuration("runner.period"))

		var gracefulStop = make(chan os.Signal, 1)
		signal.Notify(gracefulStop, syscall.SIGTERM)
		signal.Notify(gracefulStop, syscall.SIGINT)
		signal.Notify(gracefulStop, os.Interrupt)
		<-gracefulStop

		epicRunner.Stop()
		sprintRunner.Stop()
	},
}

RootCmd main command of jerem

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