<commit_before>package config

import (
	"fmt"
	"os"

	"github.com/jvehent/gozdef"
	"gopkg.in/gcfg.v1"
)

type Config struct {
	General struct {
		Enable         bool
		Postgres       string
		PostgresDB     string
		PostgresUser   string
		PostgresPass   string
		CipherscanPath string
		GoRoutines     int // * cores = The Max number of spawned Goroutines
	}
	TrustStores struct {
		Ubuntu_TS    string
		Mozilla_TS   string
		Microsoft_TS string
		Apple_TS     string
		Android_TS   string
	}
	MozDef gozdef.MqConf
}

func Load(path string) (conf Config, err error) {
	defer func() {
		if e := recover(); e != nil {
			err = fmt.Errorf("configLoad() -> %v", e)
		}
	}()
	err = gcfg.ReadFileInto(&conf, path)
	if err != nil {
		panic(err)
	}
	if os.Getenv("TLSOBS_POSTGRES") != "" {
		conf.General.Postgres = os.Getenv("TLSOBS_POSTGRES")
	}
	if os.Getenv("TLSOBS_POSTGRESDB") != "" {
		conf.General.PostgresDB = os.Getenv("TLSOBS_POSTGRESDB")
	}
	if os.Getenv("TLSOBS_POSTGRESUSER") != "" {<commit_msg>changed config struct variable as it seems the _ character is not allowed<commit_after>package config

import (
	"fmt"
	"os"

	"github.com/jvehent/gozdef"
	"gopkg.in/gcfg.v1"
)

type Config struct {
	General struct {
		Enable         bool
		Postgres       string
		PostgresDB     string
		PostgresUser   string
		PostgresPass   string
		CipherscanPath string
		GoRoutines     int // * cores = The Max number of spawned Goroutines
	}
	TrustStores struct {
		UbuntuTS    string
		MozillaTS   string
		MicrosoftTS string
		AppleTS     string
		AndroidTS   string
	}
	MozDef gozdef.MqConf
}

func Load(path string) (conf Config, err error) {
	defer func() {
		if e := recover(); e != nil {
			err = fmt.Errorf("configLoad() -> %v", e)
		}
	}()
	err = gcfg.ReadFileInto(&conf, path)
	if err != nil {
		panic(err)
	}
	if os.Getenv("TLSOBS_POSTGRES") != "" {
		conf.General.Postgres = os.Getenv("TLSOBS_POSTGRES")
	}
	if os.Getenv("TLSOBS_POSTGRESDB") != "" {
		conf.General.PostgresDB = os.Getenv("TLSOBS_POSTGRESDB")
	}
	if os.Getenv("TLSOBS_POSTGRESUSER") != "" {
{'fraction_non_alphanumeric': 0.11924381968007755, 'fraction_numerical': 0.0009694619486185168, 'mean_word_length': 3.2556701030927835, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6369073', 'n_tokens_mistral': 842, 'n_tokens_neox': 785, 'n_words': 175}