Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterConfigInstaller ¶
func RegisterConfigInstaller(ci ConfigInstaller)
RegisterConfigInstaller registers a config installer.
Types ¶
type Config ¶
type Config struct { // IP is the ip to listen. Empty means `0.0.0.0`. IP string // Port is the port to listen. Port uint16 // Logger is used to output info inside framework. Logger log.Logger // Descriptors contains all APIs. Descriptors []definition.Descriptor // Filters is http filters. Filters []service.Filter // Modifiers is definition modifiers Modifiers service.DefinitionModifiers // contains filtered or unexported fields }
Config describes configuration of server.
func NewDefaultConfig ¶
NewDefaultConfig creates default config. Default config contains:
Filters: RedirectTrailingSlash, FillLeadingSlash, ParseRequestForm. Modifiers: FirstContextParameter, EmptyConsumeForHTTPGet, ConsumeAllIfComsumesIsEmpty, ProduceAllIfProducesIsEmpty, ConsumeNoneForHTTPGet, ConsumeNoneForHTTPDelete, ProduceNoneForHTTPDelete.
func (*Config) Configure ¶
func (c *Config) Configure(configurers ...Configurer) *Config
Configure configs by configurers. It panics if an error occurs.
type ConfigInstaller ¶
type ConfigInstaller interface { // Name is the external config name. Name() string // Install installs stuffs before server starting. Install(builder service.Builder, config *Config) error // Uninstall uninstalls stuffs after server terminating. Uninstall(builder service.Builder, config *Config) error }
ConfigInstaller is used to install config to service builder.
func ConfigInstallerFor ¶
func ConfigInstallerFor(name string) ConfigInstaller
ConfigInstallerFor gets installer by name.
type Configurer ¶
Configurer is used to configure server config.
func Descriptor ¶
func Descriptor(descriptors ...definition.Descriptor) Configurer
Descriptor returns a configurer to add descriptors into config.
func Filter ¶
func Filter(filters ...service.Filter) Configurer
Filter returns a configurer to add filters into config.
func Logger ¶
func Logger(logger log.Logger) Configurer
Logger returns a configurer to set logger into config.
func Modifier ¶
func Modifier(modifiers ...service.DefinitionModifier) Configurer
Modifier returns a configurer to add definition modifiers into config.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
examples
|
|
openapi/pkg/api/v1
Package v1 is definition of api +caicloud:openapi=true
|
Package v1 is definition of api +caicloud:openapi=true |
hack
|
|
operators
|
|
plugins
|
|
utils
|
|
Click to show internal directories.
Click to hide internal directories.