Documentation
¶
Index ¶
- Constants
- func RegisterGfEntryYAML(raw []byte) map[string]rkentry.Entry
- type BootGf
- type GfEntry
- func (entry *GfEntry) AddMiddleware(inters ...ghttp.HandlerFunc)
- func (entry *GfEntry) Bootstrap(ctx context.Context)
- func (entry *GfEntry) GetDescription() string
- func (entry *GfEntry) GetName() string
- func (entry *GfEntry) GetType() string
- func (entry *GfEntry) Interrupt(ctx context.Context)
- func (entry *GfEntry) IsCommonServiceEnabled() bool
- func (entry *GfEntry) IsDocsEnabled() bool
- func (entry *GfEntry) IsPProfEnabled() bool
- func (entry *GfEntry) IsPromEnabled() bool
- func (entry *GfEntry) IsStaticFileHandlerEnabled() bool
- func (entry *GfEntry) IsSwEnabled() bool
- func (entry *GfEntry) IsTlsEnabled() bool
- func (entry *GfEntry) MarshalJSON() ([]byte, error)
- func (entry *GfEntry) String() string
- func (entry *GfEntry) UnmarshalJSON([]byte) error
- type GfEntryOption
- func WithCertEntry(certEntry *rkentry.CertEntry) GfEntryOption
- func WithCommonServiceEntry(commonServiceEntry *rkentry.CommonServiceEntry) GfEntryOption
- func WithDescription(description string) GfEntryOption
- func WithDocsEntry(docsEntry *rkentry.DocsEntry) GfEntryOption
- func WithEventEntry(eventLogger *rkentry.EventEntry) GfEntryOption
- func WithLoggerEntry(zapLogger *rkentry.LoggerEntry) GfEntryOption
- func WithMiddlewares(inters ...ghttp.HandlerFunc) GfEntryOption
- func WithName(name string) GfEntryOption
- func WithPProfEntry(p *rkentry.PProfEntry) GfEntryOption
- func WithPort(port uint64) GfEntryOption
- func WithPromEntry(prom *rkentry.PromEntry) GfEntryOption
- func WithStaticFileHandlerEntry(staticEntry *rkentry.StaticFileHandlerEntry) GfEntryOption
- func WithSwEntry(sw *rkentry.SWEntry) GfEntryOption
Constants ¶
const (
// GfEntryType type of entry
GfEntryType = "GoFrameEntry"
)
Variables ¶
This section is empty.
Functions ¶
func RegisterGfEntryYAML ¶ added in v1.0.0
RegisterGfEntryYAML register GoFrame entries with provided config file (Must YAML file).
Currently, support two ways to provide config file path. 1: With function parameters 2: With command line flag "--rkboot" described in rkcommon.BootConfigPathFlagKey (Will override function parameter if exists) Command line flag has high priority which would override function parameter
Error handling: Process will shutdown if any errors occur with rkcommon.ShutdownWithError function
Override elements in config file: We learned from HELM source code which would override elements in YAML file with "--set" flag followed with comma separated key/value pairs.
We are using "--rkset" described in rkcommon.BootConfigOverrideKey in order to distinguish with user flags Example of common usage: ./binary_file --rkset "key1=val1,key2=val2" Example of nested map: ./binary_file --rkset "outer.inner.key=val" Example of slice: ./binary_file --rkset "outer[0].key=val"
Types ¶
type BootGf ¶ added in v1.0.0
type BootGf struct { Gf []struct { Enabled bool `yaml:"enabled" json:"enabled"` Name string `yaml:"name" json:"name"` Port uint64 `yaml:"port" json:"port"` Description string `yaml:"description" json:"description"` CertEntry string `yaml:"certEntry" json:"certEntry"` LoggerEntry string `yaml:"loggerEntry" json:"loggerEntry"` EventEntry string `yaml:"eventEntry" json:"eventEntry"` SW rkentry.BootSW `yaml:"sw" json:"sw"` Docs rkentry.BootDocs `yaml:"docs" json:"docs"` CommonService rkentry.BootCommonService `yaml:"commonService" json:"commonService"` Prom rkentry.BootProm `yaml:"prom" json:"prom"` Static rkentry.BootStaticFileHandler `yaml:"static" json:"static"` PProf rkentry.BootPProf `yaml:"pprof" json:"pprof"` Middleware struct { Ignore []string `yaml:"ignore" json:"ignore"` Logging rkmidlog.BootConfig `yaml:"logging" json:"logging"` Prom rkmidprom.BootConfig `yaml:"prom" json:"prom"` Auth rkmidauth.BootConfig `yaml:"auth" json:"auth"` Cors rkmidcors.BootConfig `yaml:"cors" json:"cors"` Meta rkmidmeta.BootConfig `yaml:"meta" json:"meta"` Jwt rkmidjwt.BootConfig `yaml:"jwt" json:"jwt"` Secure rkmidsec.BootConfig `yaml:"secure" json:"secure"` RateLimit rkmidlimit.BootConfig `yaml:"rateLimit" json:"rateLimit"` Csrf rkmidcsrf.BootConfig `yaml:"csrf" yaml:"csrf"` Trace rkmidtrace.BootConfig `yaml:"trace" json:"trace"` } `yaml:"middleware" json:"middleware"` } `yaml:"gf" json:"gf"` }
BootGf boot config which is for GoFrame entry.
type GfEntry ¶
type GfEntry struct { LoggerEntry *rkentry.LoggerEntry `json:"-" yaml:"-"` EventEntry *rkentry.EventEntry `json:"-" yaml:"-"` CertEntry *rkentry.CertEntry `json:"-" yaml:"-"` Port uint64 `json:"-" yaml:"-"` Server *ghttp.Server `json:"-" yaml:"-"` SwEntry *rkentry.SWEntry `json:"-" yaml:"-"` CommonServiceEntry *rkentry.CommonServiceEntry `json:"-" yaml:"-"` PromEntry *rkentry.PromEntry `json:"-" yaml:"-"` DocsEntry *rkentry.DocsEntry `json:"-" yaml:"-"` StaticFileEntry *rkentry.StaticFileHandlerEntry `json:"-" yaml:"-"` PProfEntry *rkentry.PProfEntry `json:"-" yaml:"-"` Middlewares []ghttp.HandlerFunc `json:"-" yaml:"-"` // contains filtered or unexported fields }
GfEntry implements rkentry.Entry interface.
func GetGfEntry ¶
GetGfEntry Get GfEntry from rkentry.GlobalAppCtx.
func RegisterGfEntry ¶
func RegisterGfEntry(opts ...GfEntryOption) *GfEntry
RegisterGfEntry register GfEntry with options.
func (*GfEntry) AddMiddleware ¶ added in v1.0.0
func (entry *GfEntry) AddMiddleware(inters ...ghttp.HandlerFunc)
AddMiddleware Add middleware. This function should be called before Bootstrap() called.
func (*GfEntry) GetDescription ¶
GetDescription Get description of entry.
func (*GfEntry) IsCommonServiceEnabled ¶
IsCommonServiceEnabled Is common service entry enabled?
func (*GfEntry) IsDocsEnabled ¶ added in v1.0.0
IsDocsEnabled Is Docs entry enabled?
func (*GfEntry) IsPProfEnabled ¶ added in v1.1.0
IsPProfEnabled Is pprof entry enabled?
func (*GfEntry) IsPromEnabled ¶
IsPromEnabled Is prometheus entry enabled?
func (*GfEntry) IsStaticFileHandlerEnabled ¶ added in v0.0.2
IsStaticFileHandlerEnabled Is static file handler entry enabled?
func (*GfEntry) IsSwEnabled ¶
IsSwEnabled Is swagger entry enabled?
func (*GfEntry) IsTlsEnabled ¶
IsTlsEnabled Is TLS enabled?
func (*GfEntry) MarshalJSON ¶
MarshalJSON Marshal entry.
func (*GfEntry) UnmarshalJSON ¶
UnmarshalJSON Not supported.
type GfEntryOption ¶
type GfEntryOption func(*GfEntry)
GfEntryOption Gf entry option.
func WithCertEntry ¶ added in v0.0.8
func WithCertEntry(certEntry *rkentry.CertEntry) GfEntryOption
WithCertEntry provide rkentry.CertEntry.
func WithCommonServiceEntry ¶ added in v0.0.8
func WithCommonServiceEntry(commonServiceEntry *rkentry.CommonServiceEntry) GfEntryOption
WithCommonServiceEntry provide CommonServiceEntry.
func WithDescription ¶ added in v0.0.8
func WithDescription(description string) GfEntryOption
WithDescription provide name.
func WithDocsEntry ¶ added in v1.0.0
func WithDocsEntry(docsEntry *rkentry.DocsEntry) GfEntryOption
WithDocsEntry provide rkentry.DocsEntry.
func WithEventEntry ¶ added in v1.0.0
func WithEventEntry(eventLogger *rkentry.EventEntry) GfEntryOption
WithEventEntry provide rkentry.EventEntry.
func WithLoggerEntry ¶ added in v1.0.0
func WithLoggerEntry(zapLogger *rkentry.LoggerEntry) GfEntryOption
WithLoggerEntry provide rkentry.LoggerEntry.
func WithMiddlewares ¶ added in v1.0.0
func WithMiddlewares(inters ...ghttp.HandlerFunc) GfEntryOption
WithMiddlewares provide user interceptors.
func WithPProfEntry ¶ added in v1.1.0
func WithPProfEntry(p *rkentry.PProfEntry) GfEntryOption
WithPProfEntry provide rkentry.PProfEntry.
func WithPromEntry ¶ added in v0.0.8
func WithPromEntry(prom *rkentry.PromEntry) GfEntryOption
WithPromEntry provide PromEntry.
func WithStaticFileHandlerEntry ¶ added in v0.0.8
func WithStaticFileHandlerEntry(staticEntry *rkentry.StaticFileHandlerEntry) GfEntryOption
WithStaticFileHandlerEntry provide StaticFileHandlerEntry.
func WithSwEntry ¶ added in v0.0.8
func WithSwEntry(sw *rkentry.SWEntry) GfEntryOption
WithSwEntry provide SwEntry.