Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnvWithDefault ¶
GetEnvWithDefault 获取环境变量,如果不存在则返回默认值
Types ¶
type Config ¶
type Config struct {
// 基础配置
BaseURL string `mapstructure:"base_url" yaml:"base_url" json:"base_url"`
AuthType string `mapstructure:"auth_type" yaml:"auth_type" json:"auth_type"`
Token string `mapstructure:"token" yaml:"token" json:"token"`
Timeout time.Duration `mapstructure:"timeout" yaml:"timeout" json:"timeout"`
MaxRetries int `mapstructure:"max_retries" yaml:"max_retries" json:"max_retries"`
// 工作空间配置
WorkspaceID string `mapstructure:"workspace_id" yaml:"workspace_id" json:"workspace_id"`
// 日志配置
LogLevel string `mapstructure:"log_level" yaml:"log_level" json:"log_level"`
LogFormat string `mapstructure:"log_format" yaml:"log_format" json:"log_format"`
LogOutput string `mapstructure:"log_output" yaml:"log_output" json:"log_output"`
LogFile string `mapstructure:"log_file" yaml:"log_file" json:"log_file"`
// 监控配置
EnableMetrics bool `mapstructure:"enable_metrics" yaml:"enable_metrics" json:"enable_metrics"`
MetricsPort int `mapstructure:"metrics_port" yaml:"metrics_port" json:"metrics_port"`
HealthCheck bool `mapstructure:"health_check" yaml:"health_check" json:"health_check"`
// 连接池配置
MaxIdleConns int `mapstructure:"max_idle_conns" yaml:"max_idle_conns" json:"max_idle_conns"`
MaxIdleConnsPerHost int `mapstructure:"max_idle_conns_per_host" yaml:"max_idle_conns_per_host" json:"max_idle_conns_per_host"`
IdleConnTimeout time.Duration `mapstructure:"idle_conn_timeout" yaml:"idle_conn_timeout" json:"idle_conn_timeout"`
}
Config 应用配置
Click to show internal directories.
Click to hide internal directories.