Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthOptions ¶
type AuthOptions struct {
JWTSecret string `json:"jwtSecret" mapstructure:"jwtSecret"`
EncryptionKey string `json:"encryptionKey" mapstructure:"encryptionKey"` // 32 bytes for AES-256
TokenDuration time.Duration `json:"tokenDuration" mapstructure:"tokenDuration"`
SendCodeRateLimit time.Duration `json:"sendCodeRateLimit" mapstructure:"sendCodeRateLimit"`
Issuer string `json:"issuer" mapstructure:"issuer"`
PrivateKey string `json:"privateKey" mapstructure:"privateKey"`
PublicKey string `json:"publicKey" mapstructure:"publicKey"`
}
AuthOptions contains authentication-specific configuration
func NewAuthOptions ¶
func NewAuthOptions() *AuthOptions
NewServerOptions create a `zero` value instance.
func (*AuthOptions) Complete ¶
func (o *AuthOptions) Complete()
Complete sets default values for AuthOptions.
func (*AuthOptions) Sanitize ¶
func (o *AuthOptions) Sanitize() *AuthOptions
Sanitize returns a copy of the options with sensitive data masked.
func (*AuthOptions) Validate ¶
func (o *AuthOptions) Validate() []error
Validate verifies flags passed to RedisOptions.
type CloudProviderOptions ¶
type CloudProviderOptions struct {
AliyunUID string `json:"ALIYUN_UID" mapstructure:"ALIYUN_UID"`
AliyunAccessKeyID string `json:"ALIBABA_CLOUD_ACCESS_KEY_ID" mapstructure:"ALIBABA_CLOUD_ACCESS_KEY_ID"`
AliyunAccessKeySecret string `json:"ALIBABA_CLOUD_ACCESS_KEY_SECRET" mapstructure:"ALIBABA_CLOUD_ACCESS_KEY_SECRET"`
}
AuthOptions contains authentication-specific configuration
func NewCloudProviderOptions ¶
func NewCloudProviderOptions() *CloudProviderOptions
NewServerOptions create a `zero` value instance.
func (*CloudProviderOptions) Validate ¶
func (o *CloudProviderOptions) Validate() []error
type ConfigCenterOptions ¶
type ConfigCenterOptions struct {
Type string `json:"type" mapstructure:"type"` // nacos, consul, etc.
Address string `json:"address" mapstructure:"address"`
Namespace string `json:"namespace" mapstructure:"namespace"`
}
ConfigCenterOptions contains configuration center options
func NewConfigCenterOptions ¶
func NewConfigCenterOptions() *ConfigCenterOptions
NewServerOptions create a `zero` value instance.
type EmailOptions ¶
type EmailOptions struct {
Host string `json:"host" mapstructure:"host"`
Port int `json:"port" mapstructure:"port"`
Username string `json:"username" mapstructure:"username"`
Password string `json:"password" mapstructure:"password"`
From string `json:"from" mapstructure:"from"`
UseSSL bool `json:"use_ssl" mapstructure:"use-ssl"` // For Implicit TLS (usually port 465)
SkipVerify bool `json:"skip_verify" mapstructure:"skip-verify"` // Skip TLS certificate verification
}
EmailOptions definition
func NewEmailOptions ¶
func NewEmailOptions() *EmailOptions
NewEmailOptions creates a new EmailOptions object with default parameters.
func (*EmailOptions) Sanitize ¶
func (o *EmailOptions) Sanitize() *EmailOptions
Sanitize returns a copy of the options with sensitive data masked.
func (*EmailOptions) Validate ¶
func (o *EmailOptions) Validate() []error
Validate checks availability of the options.
type GRPCOptions ¶
type GRPCOptions struct {
Port int `json:"port,omitempty" mapstructure:"port"`
MaxConnectionAge time.Duration `json:"max-connection-age,omitempty" mapstructure:"max-connection-age"`
MaxConnectionAgeGrace time.Duration `json:"max-connection-age-grace,omitempty" mapstructure:"max-connection-age-grace"`
KeepAliveTime time.Duration `json:"keep-alive-time,omitempty" mapstructure:"keep-alive-time"`
KeepAliveTimeout time.Duration `json:"keep-alive-timeout,omitempty" mapstructure:"keep-alive-timeout"`
}
GRPCOptions defines configuration for gRPC server.
func NewGRPCOptions ¶
func NewGRPCOptions() *GRPCOptions
NewGRPCOptions creates a new GRPCOptions with default values.
func (*GRPCOptions) AddFlags ¶
func (o *GRPCOptions) AddFlags(fs *pflag.FlagSet)
AddFlags adds flags for GRPCOptions to the specified FlagSet.
func (*GRPCOptions) Validate ¶
func (o *GRPCOptions) Validate() []error
Validate checks GRPCOptions for validation errors.
type HTTPOptions ¶
type HTTPOptions struct {
Port int `json:"port" mapstructure:"port"`
ReadTimeout time.Duration `json:"readTimeout" mapstructure:"readTimeout"`
WriteTimeout time.Duration `json:"writeTimeout" mapstructure:"writeTimeout"`
ShutdownTimeout time.Duration `json:"shutdownTimeout" mapstructure:"shutdownTimeout"`
TrustedProxies []string `json:"trustedProxies" mapstructure:"trustedProxies"`
}
HTTPOptions contains http server specific configuration
func NewHTTPOptions ¶
func NewHTTPOptions() *HTTPOptions
NewHTTPOptions create a `zero` value instance.
func (*HTTPOptions) Validate ¶
func (o *HTTPOptions) Validate() []error
Validate verifies flags passed to HTTPOptions.
type JobOptions ¶
type JobOptions struct {
Enabled bool `json:"enabled" mapstructure:"enabled"` // Global switch for Cron service
CommonJob bool `json:"commonJob" mapstructure:"commonJob"`
}
AuthOptions contains authentication-specific configuration
func NewJobOptions ¶
func NewJobOptions() *JobOptions
NewServerOptions create a `zero` value instance.
func (*JobOptions) Validate ¶
func (o *JobOptions) Validate() []error
Validate verifies flags passed to JobOptions.
type LogOptions ¶
type LogOptions struct {
Level string `json:"level" mapstructure:"level"`
Format string `json:"format" mapstructure:"format"`
OutputPaths []string `json:"output-paths" mapstructure:"output-paths"`
EnableSQL bool `json:"enable-sql" mapstructure:"enable-sql"`
// Rotation Config
EnableRotation bool `json:"enable-rotation" mapstructure:"enable-rotation"`
RotateLogPath string `json:"rotate-log-path" mapstructure:"rotate-log-path"` // e.g. /var/log/iam/iam.log
MaxSize int `json:"max-size" mapstructure:"max-size"` // Megabytes
MaxBackups int `json:"max-backups" mapstructure:"max-backups"`
MaxAge int `json:"max-age" mapstructure:"max-age"` // Days
Compress bool `json:"compress" mapstructure:"compress"`
}
LogOptions contains configuration for logging.
func NewLogOptions ¶
func NewLogOptions() *LogOptions
NewLogOptions creates a new LogOptions object with default parameters.
func (*LogOptions) AddFlags ¶
func (o *LogOptions) AddFlags(fs *pflag.FlagSet)
AddFlags adds flags for the log options to the specified FlagSet.
func (*LogOptions) Complete ¶
func (o *LogOptions) Complete() error
Complete completes all the required options.
func (*LogOptions) Validate ¶
func (o *LogOptions) Validate() []error
Validate checks if the options are valid.
type MySQLOptions ¶
type MySQLOptions 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"`
AutoMigrate bool `json:"auto-migrate" mapstructure:"auto-migrate"`
}
MySQLOptions defines options for mysql database.
func NewMySQLOptions ¶
func NewMySQLOptions() *MySQLOptions
NewMySQLOptions create a `zero` value instance.
func (*MySQLOptions) Sanitize ¶
func (o *MySQLOptions) Sanitize() *MySQLOptions
Sanitize returns a copy of the options with sensitive data masked.
func (*MySQLOptions) Validate ¶
func (o *MySQLOptions) Validate() []error
Validate verifies flags passed to MySQLOptions.
type RateLimitOptions ¶
type RateLimitOptions struct {
// 全局默认限流配置
DefaultRate float64 `json:"defaultRate" mapstructure:"defaultRate"` // 每秒请求数
DefaultBurst int `json:"defaultBurst" mapstructure:"defaultBurst"` // 桶容量
// 是否启用限流
Enabled bool `json:"enabled" mapstructure:"enabled"`
// 是否启用管理API
EnableAdminAPI bool `json:"enableAdminAPI" mapstructure:"enableAdminAPI"`
// 管理API路径前缀
AdminAPIPrefix string `json:"adminAPIPrefix" mapstructure:"adminAPIPrefix"`
// 限流器清理间隔(分钟)
CleanupInterval int `json:"cleanupInterval" mapstructure:"cleanupInterval"`
}
RateLimitOptions contains rate limiting configuration
func NewRateLimitOptions ¶
func NewRateLimitOptions() *RateLimitOptions
NewRateLimitOptions create a `zero` value instance.
func (*RateLimitOptions) Validate ¶
func (o *RateLimitOptions) Validate() []error
Validate verifies flags passed to RateLimitOptions.
type RedisOptions ¶
type RedisOptions struct {
Host string `mapstructure:"host"`
Port int `mapstructure:"port"`
Password string `mapstructure:"password"`
DB int `mapstructure:"db"`
PoolSize int `mapstructure:"pool-size"`
MinIdleConns int `mapstructure:"min-idle-conns"`
DialTimeout time.Duration `mapstructure:"dial-timeout"`
ReadTimeout time.Duration `mapstructure:"read-timeout"`
WriteTimeout time.Duration `mapstructure:"write-timeout"`
EnableTLS bool `mapstructure:"enable-tls"`
Protocol int `mapstructure:"protocol"`
}
RedisOptions contains Redis-specific configuration
func NewRedisOptions ¶
func NewRedisOptions() *RedisOptions
NewRedisOptions create a `zero` value instance.
func (*RedisOptions) Sanitize ¶
func (o *RedisOptions) Sanitize() *RedisOptions
Sanitize returns a copy of the options with sensitive data masked.
func (*RedisOptions) Validate ¶
func (o *RedisOptions) Validate() []error
Validate verifies flags passed to RedisOptions.
type WeComOptions ¶
type WeComOptions struct {
CorpID string `json:"corpId" mapstructure:"corpId"`
AgentID string `json:"agentId" mapstructure:"agentId"`
Secret string `json:"secret" mapstructure:"secret"`
RedirectURI string `json:"redirectUri" mapstructure:"redirectUri"`
}
WeComOptions contains WeCom-specific configuration
func NewWeComOptions ¶
func NewWeComOptions() *WeComOptions
NewWeComOptions create a `zero` value instance.
func (*WeComOptions) Sanitize ¶
func (o *WeComOptions) Sanitize() *WeComOptions
Sanitize returns a copy of the options with sensitive data masked.
func (*WeComOptions) Validate ¶
func (o *WeComOptions) Validate() []error
Validate verifies flags passed to WeComOptions.