func Init()

in internal/settings/settings.go [19:39]


func Init() {
	viper.AutomaticEnv()
	// NOTE: err value is ignored as it only checks for missing argument
	_ = viper.BindEnv(envPrefix)

	setDefaults()
	setConstants()

	viper.AddConfigPath(viper.GetString("config_file"))
	viper.SetConfigName("config")
	viper.SetConfigType("yaml")

	// TODO: better error handling (skip missing file error)
	if err := viper.ReadInConfig(); err == nil {
		log.Println("Using config file:", viper.ConfigFileUsed())
	} else {
		// NOTE: we do not fail in this case as it's ok not to have the config file
		// but we want to alert the user that the file has not been found
		log.Println(err)
	}
}