Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsTerminal ¶ added in v1.6.14
func IsTerminal() bool
IsTerminal reports whether os.Stderr is an interactive terminal.
Types ¶
type RegisterFunc ¶ added in v1.6.14
type RegisterFunc func(*httprouter.Router, server.Cmd) error
RegisterFunc is called after the router is created but before the server starts listening. Use it to add routes and wire up handlers.
type RunServer ¶ added in v1.6.14
type RunServer struct {
OpenAPI bool `name:"openapi" help:"Serve OpenAPI spec at {prefix}/openapi.{json,yaml,html}" default:"true" negatable:""`
// TLS server options
TLS struct {
ServerName string `name:"name" help:"TLS server name"`
CertFile string `name:"cert" help:"TLS certificate file"`
KeyFile string `name:"key" help:"TLS key file"`
} `embed:"" prefix:"tls."`
// contains filtered or unexported fields
}
RunServer is a general-purpose "run" command. Embed it in your CLI's command struct to get a fully functional HTTP server with logging and OTel middleware.
func (*RunServer) Register ¶ added in v1.6.14
func (s *RunServer) Register(fns ...RegisterFunc) *RunServer
Register appends fns to the list of functions called to wire up routes before the server starts. Returns the receiver for chaining.