Documentation
¶
Overview ¶
Package app provides app logic for the opampcommander apiserver.
Index ¶
- Constants
- func AsController(f any) any
- func NewEngine(controllers []Controller) *gin.Engine
- func NewEtcdClient(settings *ServerSettings) (*clientv3.Client, error)
- func NewHTTPServer(lifecycle fx.Lifecycle, engine *gin.Engine, settings *ServerSettings, ...) *http.Server
- func NewLogger() *slog.Logger
- type Controller
- type Server
- type ServerSettings
Constants ¶
View Source
const ( // DefaultHTTPReadTimeout is the default timeout for reading HTTP requests. // It should be set to a reasonable value to avoid security issues. DefaultHTTPReadTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func AsController ¶
AsController is a helper function to annotate a function as a controller.
func NewEngine ¶
func NewEngine(controllers []Controller) *gin.Engine
NewEngine creates a new Gin engine and registers the provided controllers' routes.
func NewEtcdClient ¶
func NewEtcdClient(settings *ServerSettings) (*clientv3.Client, error)
NewEtcdClient creates a new etcd client with the given settings.
Types ¶
type Controller ¶
type Controller interface {
RoutesInfo() gin.RoutesInfo
}
Controller is an interface that defines the methods for handling HTTP requests.
type Server ¶
Server is a struct that represents the server application. It embeds the fx.App struct from the Uber Fx framework.
func NewServer ¶
func NewServer(settings ServerSettings) *Server
NewServer creates a new instance of the Server struct.
type ServerSettings ¶
ServerSettings is a struct that holds the server settings.
Click to show internal directories.
Click to hide internal directories.