<commit_before>// Package config ...
package config

import "github.com/spf13/viper"

//
var config *viper.Viper

// Get fetches a generic value from viper config
func Get(key string) interface{} {

	// parse the config file if it's not already
	if config == nil {
		if err := parseConfig(); err != nil {
			return nil
		}
	}

	return config.Get(key)
}

// Viper returns the viper config object
func Viper() *viper.Viper {

	// parse the config file if it's not already
	if config == nil {
		if err := parseConfig(); err != nil {
			return nil
		}
	}

	return config
}

// ParseConfig will load the config file and parse it with viper
func parseConfig() error {

	// initilize a viper parser
	config = viper.New()

	// set sensible defaults
<commit_msg>in config when loading viper it needs to return viper to fix a bug where we were using it as a nil pointer<commit_after>// Package config ...
package config

import "github.com/spf13/viper"

//
var config *viper.Viper

// Get fetches a generic value from viper config
func Get(key string) interface{} {

	// parse the config file if it's not already
	if config == nil {
		if err := parseConfig(); err != nil {
			return nil
		}
	}

	return config.Get(key)
}

// Viper returns the viper config object
func Viper() *viper.Viper {

	// parse the config file if it's not already
	if config == nil {
		if err := parseConfig(); err != nil {
			lumber.Error("config:Viper():parseConfig(): %s", err.Error())
		}
	}

	return config
}

// ParseConfig will load the config file and parse it with viper
func parseConfig() error {

	// initilize a viper parser
	config = viper.New()

	// set sensible defaults

{'fraction_non_alphanumeric': 0.10848484848484849, 'fraction_numerical': 0.0024242424242424242, 'mean_word_length': 3.1275, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1165820', 'n_tokens_mistral': 549, 'n_tokens_neox': 514, 'n_words': 211}