server

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: AGPL-3.0 Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "server",
	Short: "serve the battlesnake game engine",
	PreRun: func(c *cobra.Command, args []string) {
		if !promEnable {
			log.Info("prometheus exporter not enabled")
			return
		}

		log.WithField("addr", promListen).Info("starting prometheus exporter")
		http.Handle("/metrics", promhttp.Handler())
		go func() {
			r := http.NewServeMux()
			r.Handle("/metrics", promhttp.Handler())
			if err := http.ListenAndServe(promListen, r); err != nil {
				log.WithError(err).Warn("prometheus failes to listen")
			}
		}()
	},
	Run: func(c *cobra.Command, args []string) {
		go controllerCmd.Run(c, args)
		go apiCmd.Run(c, args)
		workerCmd.Run(c, args)
	},
}

RootCmd provides the root run command.

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