options

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

nolint: err113

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ServerOptions

type ServerOptions struct {
	// ServerMode 定义服务器模式:gRPC、Gin HTTP、HTTP Reverse Proxy.
	ServerMode string `json:"server-mode" mapstructure:"server-mode"`
	// JWTKey 定义 JWT 密钥.
	JWTKey string `json:"jwt-key" mapstructure:"jwt-key"`
	// Expiration 定义 JWT Token 的过期时间.
	Expiration time.Duration `json:"expiration" mapstructure:"expiration"`
	// EnableMemoryStore 指示是否启用内存数据库(用于测试或开发环境).
	EnableMemoryStore bool `json:"enable-memory-store" mapstructure:"enable-memory-store"`
	// TLSOptions 包含 TLS 配置选项.
	TLSOptions *genericoptions.TLSOptions `json:"tls" mapstructure:"tls"`
	// HTTPOptions 包含 HTTP 配置选项.
	HTTPOptions *genericoptions.HTTPOptions `json:"http" mapstructure:"http"`
	// GRPCOptions 包含 gRPC 配置选项.
	GRPCOptions *genericoptions.GRPCOptions `json:"grpc" mapstructure:"grpc"`
	// MySQLOptions 包含 MySQL 配置选项.
	MySQLOptions *genericoptions.MySQLOptions `json:"mysql" mapstructure:"mysql"`
}

ServerOptions 包含服务器配置选项.

func NewServerOptions

func NewServerOptions() *ServerOptions

NewServerOptions 创建带有默认值的 ServerOptions 实例.

func (*ServerOptions) AddFlags

func (o *ServerOptions) AddFlags(fs *pflag.FlagSet)

AddFlags 将 ServerOptions 的选项绑定到命令行标志. 通过使用 pflag 包,可以实现从命令行中解析这些选项的功能.

func (*ServerOptions) Config

func (o *ServerOptions) Config() (*apiserver.Config, error)

Config 基于 ServerOptions 构建 apiserver.Config.

func (*ServerOptions) Validate

func (o *ServerOptions) Validate() error

Validate 校验 ServerOptions 中的选项是否合法.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL