Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertKey ¶
type CertKey struct { // CertFile is a file containing a PEM-encoded certificate, and possibly the complete certificate chain CertFile string `json:"cert-file" mapstructure:"cert-file"` // KeyFile is a file containing a PEM-encoded private key for the certificate specified by CertFile KeyFile string `json:"private-key-file" mapstructure:"private-key-file"` }
密钥证书
type FeatureOptions ¶
type FeatureOptions struct { EnableProfiling bool `json:"profiling" mapstructure:"profiling"` // 是否 将 Engine 通过 pprof 进行展示 EnableMetrics bool `json:"enable-metrics" mapstructure:"enable-metrics"` }
FeatureOptions contains configuration items related to API server features. API 服务开关 (pprof和度量?)
func NewFeatureOptions ¶
func NewFeatureOptions() *FeatureOptions
NewFeatureOptions creates a FeatureOptions object with default parameters.
func (*FeatureOptions) AddFlags ¶
func (o *FeatureOptions) AddFlags(fs *pflag.FlagSet)
AddFlags adds flags related to features for a specific api server to the specified FlagSet.
func (*FeatureOptions) ApplyTo ¶
func (o *FeatureOptions) ApplyTo(c *server.ServerConfig) error
ApplyTo applies the run options to the method receiver and returns self.
func (*FeatureOptions) Validate ¶
func (o *FeatureOptions) Validate() []error
Validate is used to parse and validate the parameters entered by the user at the command line when the program starts.
type GRPCOptions ¶
type GRPCOptions struct { Address string `json:"address" mapstructure:"address"` Port int `json:"port" mapstructure:"port"` MaxMsgSize int `json:"max-msg-size" mapstructure:"max-msg-size"` }
func NewGRPCOptions ¶
func NewGRPCOptions() *GRPCOptions
NewGRPCOptions is for creating an unauthenticated, unauthorized, insecure port. No one should be using these anymore.
func (*GRPCOptions) AddFlags ¶
func (o *GRPCOptions) AddFlags(fs *pflag.FlagSet)
AddFlags adds flags related to features for a specific api server to the specified FlagSet.
func (*GRPCOptions) Validate ¶
func (o *GRPCOptions) Validate() []error
Validate is used to parse and validate the parameters entered by the user at the command line when the program starts.
type GeneratableKeyCert ¶
type GeneratableKeyCert struct { // 配置生成证书 CertKey CertKey `json:"cert-key" mapstructure:"cert-key"` // 若无配置 则使用默认的 // 当 CertKey 未设置CertFile/KeyFile时将证书写入的目录 CertDirectory string `json:"cert-dir" mapstructure:"cert-dir"` //PairName是将与CertDirectory一起使用以生成证书和密钥文件名的名称。 PairName string `json:"pair-name" mapstructure:"pair-name"` }
证书相关
type HttpOption ¶
type HttpOption struct { Address string `json:"address" mapstructure:"address"` Port int `json:"port" mapstructure:"port"` }
func NewHttpOption ¶
func NewHttpOption() *HttpOption
func (*HttpOption) AddFlags ¶
func (o *HttpOption) AddFlags(fs *pflag.FlagSet)
func (*HttpOption) ApplyTo ¶
func (o *HttpOption) ApplyTo(s *server.ServerConfig) error
ApplyTo 将从viper得到的配置 写入到config中
func (*HttpOption) Validate ¶
func (o *HttpOption) Validate() []error
type HttpsOption ¶
type HttpsOption struct { Address string `json:"address" mapstructure:"address"` Port int `json:"port" mapstructure:"port"` ServerCert GeneratableKeyCert `json:"tls" mapstructure:"tls"` }
func NewHttpsOption ¶
func NewHttpsOption() *HttpsOption
func (*HttpsOption) AddFlags ¶
func (o *HttpsOption) AddFlags(fs *pflag.FlagSet)
func (*HttpsOption) ApplyTo ¶
func (o *HttpsOption) ApplyTo(s *server.ServerConfig) error
func (*HttpsOption) Validate ¶
func (o *HttpsOption) Validate() []error
type JwtOption ¶
type JwtOption struct { /// realm: JWT # jwt 标识 Realm string `json:"realm" mapstructure:"realm"` // realm: JWT # jwt 标识 Key string `json:"key"mapstructure:"key"` // 密钥 TimeOut time.Duration `json:"timeout" mapstructure:"timeout"` // 过期时间 MaxRefresh time.Duration `json:"max-refresh" mapstructure:"max-refresh"` // 刷新时间 }
jwt 配置
type MysqlOption ¶
type MysqlOption struct { Host string `json:"host,omitempty" mapstructure:"host"` Username string `json:"username,omitempty" mapstructure:"username"` Password string `json:"-" mapstructure:"password"` Database string `json:"database" mapstructure:"database"` MaxIdleConnections int `json:"max-idle-connections,omitempty" mapstructure:"max-idle-connections"` MaxOpenConnections int `json:"max-open-connections,omitempty" mapstructure:"max-open-connections"` MaxConnectionLifeTime time.Duration `json:"max-connection-life-time,omitempty" mapstructure:"max-connection-life-time"` LogLevel int `json:"log_level" mapstructure:"log_level"` }
func (*MysqlOption) AddFlags ¶
func (o *MysqlOption) AddFlags(fs *pflag.FlagSet)
实现AddFlags 从pflag中得到参数
func (*MysqlOption) Validate ¶
func (o *MysqlOption) Validate() []error
type RedisOptions ¶
type RedisOptions struct { Host string `json:"host" mapstructure:"host" description:"Redis service host address"` Port int `json:"port"` Addrs []string `json:"addrs" mapstructure:"addrs"` Username string `json:"username" mapstructure:"username"` Password string `json:"password" mapstructure:"password"` Database int `json:"database" mapstructure:"database"` MasterName string `json:"master-name" mapstructure:"master-name"` MaxIdle int `json:"optimisation-max-idle" mapstructure:"optimisation-max-idle"` MaxActive int `json:"optimisation-max-active" mapstructure:"optimisation-max-active"` Timeout int `json:"timeout" mapstructure:"timeout"` EnableCluster bool `json:"enable-cluster" mapstructure:"enable-cluster"` UseSSL bool `json:"use-ssl" mapstructure:"use-ssl"` SSLInsecureSkipVerify bool `json:"ssl-insecure-skip-verify" mapstructure:"ssl-insecure-skip-verify"` }
redis选项定义redis群集的选项。
type ServerRunOption ¶
type ServerRunOption struct { Mode string `json:"mode" mapstructure:"mode"` // 以指定的服务器模式启动服务器。支持的服务器模式:调试、测试、发布。 Middleware []string `json:"middleware" mapstructure:"middleware"` // server启动时使用哪些中间件 Healthz bool `json:"healthz" mapstructure:"healthz"` // 是否构建健康检查 }
func NewServerRunOption ¶
func NewServerRunOption() *ServerRunOption
func (*ServerRunOption) AddFlags ¶
func (o *ServerRunOption) AddFlags(fs *pflag.FlagSet)
specified FlagSet.
func (*ServerRunOption) ApplyTo ¶
func (o *ServerRunOption) ApplyTo(s *server.ServerConfig) error
func (*ServerRunOption) Validate ¶
func (o *ServerRunOption) Validate() []error