Documentation
¶
Overview ¶
Package cmd 提供了命令行参数解析和配置管理功能。 支持从命令行参数、环境变量和配置文件加载配置。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Port string // 16 bytes
Redis string // 16 bytes
RedisPassword string // 16 bytes
RedisEnabled bool // 1 byte (padding to 8 bytes)
RemoteConfig string // 16 bytes
RemoteKey string // 16 bytes
Mode string // 16 bytes
APIKey string // 16 bytes
TaskInterval int // 8 bytes
HTTPTimeout int // 8 bytes
HTTPMaxIdleConns int // 8 bytes
HTTPInsecureTLS bool // 1 byte (padding to 8 bytes)
}
Config 存储应用配置
func GetArgs ¶
func GetArgs() *Config
GetArgs 解析命令行参数和环境变量,返回配置结构体 优先级:命令行参数 > 环境变量 > 配置文件 > 默认值 如果提供了 -config-file 参数,会尝试从配置文件加载
func LoadConfig ¶
LoadConfig 加载配置(新接口,支持配置文件) 优先级:命令行参数 > 环境变量 > 配置文件 > 默认值
Click to show internal directories.
Click to hide internal directories.