package
Version:
v0.0.0-...-cff51de
Opens a new window with list of versions in this module.
Published: Jan 12, 2026
License: MIT
Opens a new window with license information.
Imports: 8
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
Load 加载配置到conf上,filenames 支持多个配置文件,
对应相同字段,以后者为准,解析过程中遇到错误回直接panic,因此可以忽略返回的错误
type CRMConfig struct {
ServerPort int `env:"SERVER_PORT"`
LogLevel string `env:"LOGGER_LEVEL"`
}
type DbConfig struct {
DbUser string `env:"DB_USER"`
DbPswd string `env:"DB_PASSWORD"`
DbHost string `env:"DB_HOST"`
DbPort int `env:"DB_PORT"`
DbName string `env:"DB_NAME"`
}
DbConfig 对应 /configs/develop.env配置类型定义
type JWTConfig struct {
Issuer string `env:"JWT_ISSUER"`
SecretKey string `env:"JWT_SECRETKEY"`
AccessToknExpires time.Duration `env:"JWT_ACCESSTOKEN_EXPIRES"`
RefreshToknExpires time.Duration `env:"JWT_REFRESHTOKEN_EXPIRES"`
}
type RedisConfig struct {
Host string `env:"REDIS_HOST"`
Port int `env:"REDIS_PORT"`
Password string `env:"REDIS_PASSWORD"`
DB int `env:"REDIS_DB"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.