package main import ( "strings" "github.com/spf13/viper" ) func ReadConfig() (*viper.Viper, error) { defaults := map[string]any{ "name": "COOPGO Mobility Accounts", "dev_env": false, } v := viper.New() for key, value := range defaults { v.SetDefault(key, value) } v.SetConfigName("config") v.AddConfigPath(".") v.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) v.AutomaticEnv() err := v.ReadInConfig() return v, err }