serve

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ServeCmd = &cobra.Command{
	Use:   "serve",
	Short: "Serve Ava API",
	Long:  `Serve Ava API.`,
	Run: func(cmd *cobra.Command, args []string) {
		logger := viper.Get("logger").(logger.ILogger)
		avaCfg := avaCfg.LoadConfiguration(logger)
		logger.Info("Serving Ava API")

		serverConfig := &api.Config{
			HttpServerTimeout: httpServerTimeout,
			Port:              port,
			PortMetrics:       metricsPort,
			Host:              "",
			Unhealthy:         unhealthy,
			Unready:           ready,
		}

		server, err := api.NewServer(serverConfig, logger, avaCfg)
		if err != nil {
			logger.Fatal(err.Error())
		}
		httpServer, healthy, ready := server.ListenAndServe()

		stopCh := signals.SetupSignalHandler()
		sd, _ := signals.NewShutdown(serverShutdownTimeout, logger)
		sd.Graceful(stopCh, httpServer, healthy, ready)
	},
}

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