<commit_before>package config

import (
	"github.com/davidbanham/required_env"
	"os"
)

// Port The port to listen on
var Port string

// EmailProvider The provider to use for email notifications
var EmailProvider string

// SmsProvider The provider to use for sms notifications
var SmsProvider string

// SmsFrom The default From for an SMS
var SmsFrom string

// EmailSMTPPass The password to use if sending email via SMTP/Gmail
var EmailSMTPPass string

// EmailFrom The default from: address for emails sent
var EmailFrom string

// EmailFromName The default name that email should appear to come from
var EmailFromName string

// EmailMandrillKey The key to use if sending email via Mandrill
var EmailMandrillKey string

// AwsAccessKeyID your AWS access key ID
var AwsAccessKeyID string

// AwsSecretAccessKey your AWS access key
var AwsSecretAccessKey string

// AwsRegion your AWS access region
var AwsRegion string

// Testing Whether we are in test mode
var Testing string

// DisableAuth Whether we should disable the token auth
var DisableAuth bool

// AuthSecret The shared secret API key
var AuthSecret string

func init() {
	required_env.Ensure(map[string]string{
		"PORT":                  "",
		"NOTIFY_EMAIL_PROVIDER": "",
		"NOTIFY_SMS_PROVIDER":   "",
		"NOTIFY_EMAIL_FROM":     "",
		"AUTH_SECRET":           "",
	})

	switch os.Getenv("NOTIFY_EMAIL_PROVIDER") {
	case "gmail":
		required_env.Ensure(map[string]string{
			"NOTIFY_EMAIL_SMTP_PASS": "",
			"NOTIFY_EMAIL_FROM":      "",
		})
	case "mandrill":
		required_env.Ensure(map[string]string{
			"NOTIFY_EMAIL_MANDRILL_KEY": "",
			"NOTIFY_EMAIL_FROM":         "",
		})
	case "test":
		required_env.Ensure(map[string]string{
			"NOTIFY_EMAIL_FROM": "",
		})
	}
	switch os.Getenv("NOTIFY_SMS_PROVIDER") {
	case "amazon":
		required_env.Ensure(map[string]string{
			"AWS_ACCESS_KEY_ID":     "",
			"AWS_SECRET_ACCESS_KEY": "",
			"AWS_REGION":            "",
			"NOTIFY_SMS_FROM":       "",
		})
	case "test":
		required_env.Ensure(map[string]string{
			"NOTIFY_SMS_FROM": "",
		})
	}

	Port = os.Getenv("PORT")
	EmailProvider = os.Getenv("NOTIFY_EMAIL_PROVIDER")
	SmsProvider = os.Getenv("NOTIFY_SMS_PROVIDER")
	SmsFrom = os.Getenv("NOTIFY_SMS_FROM")
	EmailSMTPPass = os.Getenv("NOTIFY_EMAIL_SMTP_PASS")
	EmailFrom = os.Getenv("NOTIFY_EMAIL_FROM")
	EmailFromName = os.Getenv("NOTIFY_EMAIL_FROM_NAME")
	EmailMandrillKey = os.Getenv("NOTIFY_EMAIL_MANDRILL_KEY")
	AwsAccessKeyID = os.Getenv("AWS_ACCESS_KEY_ID")
	AwsSecretAccessKey = os.Getenv("AWS_SECRET_ACCESS_KEY")
	AwsRegion = os.Getenv("AWS_REGION")
	Testing = os.Getenv("TESTING")

	if EmailFromName == "" {
		EmailFromName = EmailFrom
	}

	if os.Getenv("DISABLE_AUTH") == "true" {
		DisableAuth = true
	} else {
		DisableAuth = false
	}
}<commit_msg>Thread auth secret through config<commit_after>package config

import (
	"github.com/davidbanham/required_env"
	"os"
)

// Port The port to listen on
var Port string

// EmailProvider The provider to use for email notifications
var EmailProvider string

// SmsProvider The provider to use for sms notifications
var SmsProvider string

// SmsFrom The default From for an SMS
var SmsFrom string

// EmailSMTPPass The password to use if sending email via SMTP/Gmail
var EmailSMTPPass string

// EmailFrom The default from: address for emails sent
var EmailFrom string

// EmailFromName The default name that email should appear to come from
var EmailFromName string

// EmailMandrillKey The key to use if sending email via Mandrill
var EmailMandrillKey string

// AwsAccessKeyID your AWS access key ID
var AwsAccessKeyID string

// AwsSecretAccessKey your AWS access key
var AwsSecretAccessKey string

// AwsRegion your AWS access region
var AwsRegion string

// Testing Whether we are in test mode
var Testing string

// DisableAuth Whether we should disable the token auth
var DisableAuth bool

// AuthSecret The shared secret API key
var AuthSecret string

func init() {
	required_env.Ensure(map[string]string{
		"PORT":                  "",
		"NOTIFY_EMAIL_PROVIDER": "",
		"NOTIFY_SMS_PROVIDER":   "",
		"NOTIFY_EMAIL_FROM":     "",
		"AUTH_SECRET":           "",
	})

	switch os.Getenv("NOTIFY_EMAIL_PROVIDER") {
	case "gmail":
		required_env.Ensure(map[string]string{
			"NOTIFY_EMAIL_SMTP_PASS": "",
			"NOTIFY_EMAIL_FROM":      "",
		})
	case "mandrill":
		required_env.Ensure(map[string]string{
			"NOTIFY_EMAIL_MANDRILL_KEY": "",
			"NOTIFY_EMAIL_FROM":         "",
		})
	case "test":
		required_env.Ensure(map[string]string{
			"NOTIFY_EMAIL_FROM": "",
		})
	}
	switch os.Getenv("NOTIFY_SMS_PROVIDER") {
	case "amazon":
		required_env.Ensure(map[string]string{
			"AWS_ACCESS_KEY_ID":     "",
			"AWS_SECRET_ACCESS_KEY": "",
			"AWS_REGION":            "",
			"NOTIFY_SMS_FROM":       "",
		})
	case "test":
		required_env.Ensure(map[string]string{
			"NOTIFY_SMS_FROM": "",
		})
	}

	Port = os.Getenv("PORT")
	EmailProvider = os.Getenv("NOTIFY_EMAIL_PROVIDER")
	SmsProvider = os.Getenv("NOTIFY_SMS_PROVIDER")
	SmsFrom = os.Getenv("NOTIFY_SMS_FROM")
	EmailSMTPPass = os.Getenv("NOTIFY_EMAIL_SMTP_PASS")
	EmailFrom = os.Getenv("NOTIFY_EMAIL_FROM")
	EmailFromName = os.Getenv("NOTIFY_EMAIL_FROM_NAME")
	EmailMandrillKey = os.Getenv("NOTIFY_EMAIL_MANDRILL_KEY")
	AwsAccessKeyID = os.Getenv("AWS_ACCESS_KEY_ID")
	AwsSecretAccessKey = os.Getenv("AWS_SECRET_ACCESS_KEY")
	AwsRegion = os.Getenv("AWS_REGION")
	Testing = os.Getenv("TESTING")
	AuthSecret = os.Getenv("AUTH_SECRET")

	if EmailFromName == "" {
		EmailFromName = EmailFrom
	}

	if os.Getenv("DISABLE_AUTH") == "true" {
		DisableAuth = true
	} else {
		DisableAuth = false
	}
}
{'fraction_non_alphanumeric': 0.10816580679594379, 'fraction_numerical': 0.0, 'mean_word_length': 4.283834586466165, 'pattern_counts': {'":': 40, '<': 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': '6225744', 'n_tokens_mistral': 2079, 'n_tokens_neox': 2017, 'n_words': 456}