// Load parses the application configuration file and stores the values to a struct
Load parses the application configuration file and stores the values to a struct
// Load parses the application configuration file and stores the values to a struct
func Load() (Config, error) {
	viper.AddConfigPath(".")
	viper.AddConfigPath("../")
	viper.AddConfigPath("../../")
	viper.SetConfigName("config")
	viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_"))
	viper.AutomaticEnv()
	if err := viper.ReadInConfig(); err != nil {
		return Config{}, fmt.Errorf("failed to read config file: %w", err)
	}
	c := Config{}
	if err := viper.Unmarshal(&c); err != nil {
		return Config{}, fmt.Errorf("failed to unmarshal config file: %w", err)
	}
	return c, nil
}
func Load ( ) ( Config , error ) { viper . AddConfigPath ( " " ) viper . AddConfigPath ( " " ) viper . AddConfigPath ( " " ) viper . SetConfigName ( " " ) viper . SetEnvKeyReplacer ( strings . NewReplacer ( " " , " " ) ) viper . AutomaticEnv ( ) if err := viper . ReadInConfig ( ) ; err != nil { return Config { } , fmt . Errorf ( " " , err ) } c := Config { } if err := viper . Unmarshal ( & c ) ; err != nil { return Config { } , fmt . Errorf ( " " , err ) } return c , nil }
Load parses the application configuration file and stores the values to a struct
Load parses the application configuration file and stores the values to a struct