Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- type Initializer
- type Option
- type Rest
- func (r *Rest) AddRegistryTags(tags ...string)
- func (r *Rest) Address() string
- func (r *Rest) GetMetadata(key string) interface{}
- func (r *Rest) HasInitializer() bool
- func (r *Rest) Host() string
- func (r *Rest) Initializer() component.Initializer
- func (r *Rest) Port() int
- func (r *Rest) RegistryTags() []string
- func (r *Rest) String() string
Constants ¶
View Source
const (
// SERVER_TYPE is the type of the server.
SERVER_TYPE = "rest"
)
Variables ¶
View Source
var ( // ErrGatewayConfigLoad returned when env config for gRPC-gateway results in an error ErrGatewayConfigLoad = errors.New("error loading gateway config") // ErrNotDefinedHTTPServiceHandlerRegistrar thrown when http service registration handler is not provided ErrNotDefinedHTTPServiceHandlerRegistrar = errors.New("http service handler registration callback not provided") // ErrHTTPServiceHandlerRegFailed returned when any HTTP service handler registration fails ErrHTTPServiceHandlerRegFailed = errors.New("http service handler registration failed") // ErrCannotAddMuxOptionAtPos returned when adding new mux option at the specified position is not possible ErrCannotAddMuxOptionAtPos = errors.New("cannot add mux option at the position specified") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Host string `env:"HTTP_HOST,defaut="`
Port int `env:"HTTP_PORT,default=8080"`
Tags string `env:"HTTP_CONSUL_TAGS,default="`
}
Config manages the HTTP server config
func NewConfig ¶
func NewConfig() *Config
NewConfig returns the parsed config for gateway server from env
type Initializer ¶
type Initializer struct {
// contains filtered or unexported fields
}
func NewInitializer ¶
func NewInitializer(r *Rest) *Initializer
NewInitializer returns a new REST server initialiazer
func (*Initializer) AddDependency ¶
func (i *Initializer) AddDependency(dep interface{}) error
AddDependency adds necessary service components as dependencies
func (*Initializer) CanRun ¶
func (i *Initializer) CanRun() bool
CanRun returns true if the component has anything to Run
func (*Initializer) CanStop ¶
func (i *Initializer) CanStop() bool
CanRun returns true if the component has anything to Run
func (*Initializer) Dependencies ¶
func (i *Initializer) Dependencies() []string
Dependencies returns the string names of service components that are required as dependencies for this component
type Rest ¶
type Rest struct {
App *fiber.App
Options []fiber.Config
Server *http.Server
*Config
// contains filtered or unexported fields
}
Rest server using gofiber
func (*Rest) AddRegistryTags ¶
AddRegistryTags - sets the registry tags for the server
func (*Rest) GetMetadata ¶
GetMetadata returns the metadata by key
func (*Rest) HasInitializer ¶
func (*Rest) Initializer ¶
func (r *Rest) Initializer() component.Initializer
func (*Rest) RegistryTags ¶
RegistryTags returns gateway server registry tags
Click to show internal directories.
Click to hide internal directories.