INNER CODE UNIT · Go
func
sy-vendor/Gobi · config/config.go:246
func (cm *ConfigManager) load() error {
// 设置环境
cm.env = getEnvironment()
// 设置配置文件路径
cm.configPath = getConfigPath()
// 配置Viper
cm.setupViper()
// 读取配置文件
if err := cm.viper.ReadInConfig(); err != nil {
return fmt.Errorf("failed to read config file: %w", err)
}
// 根据环境获取对应的配置节
cm.viper.SetConfigName("config")