run

package
v0.0.0-...-bc2b6bc Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2016 License: MIT Imports: 10 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Port    = "app.port"
	Timeout = "app.timeout"
)

Variables

View Source
var Builder func(v *viper.Viper, l *logrus.Logger) (http.Handler, error)
View Source
var Cmd = &cobra.Command{
	Use:   "run",
	Short: "Runs the service",
	RunE: func(cmd *cobra.Command, args []string) error {
		if Builder == nil {
			return errors.New("nil builder func")
		}

		Logger.Infof("Building...")
		appHandler, err := Builder(root.Viper, Logger)
		if err != nil {
			return err
		}

		port := root.Viper.GetInt(Port)
		timeout := root.Viper.GetDuration(Timeout)

		Logger.Infof("Listening on port %d.", port)
		graceful.Run(":"+strconv.Itoa(port), timeout, appHandler)
		return nil
	},
}
View Source
var (
	Logger = logrus.New()
)

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