<commit_before>package env

import (
	"encoding/json"
	"flag"
	"os"
)

type config struct {
	Database string   `json:"database"`
	Telegram telegram `json:"telegram"`
	VK       vk       `json:"vk"`
}

type telegram struct {
	Webhook string `json:"webhook"`
	Token   string `json:"token"`
}

type vk struct {
	Confirmation string `json:"confirmation"`
	Token        string `json:"token"`
}

// Config returns current configuration.
var Config config

func init() {
	var path = os.Getenv("RAND_CHAT_ROOT")

	if flag.Lookup("test.v") == nil {
		path += "/config.json"
	} else {
		path += "/config.test.json"
	}

	file, err := os.Open(path)

	if err != nil {
		panic(err)
	}

	json.NewDecoder(file).Decode(&Config)

	if err != nil {
		panic(err)
	}
}<commit_msg>Add migrations path to env.Config<commit_after>package env

import (
	"encoding/json"
	"flag"
	"os"
	"path"
)

type config struct {
	Database   string   `json:"database"`
	Telegram   telegram `json:"telegram"`
	VK         vk       `json:"vk"`
	Migrations string
}

type telegram struct {
	Webhook string `json:"webhook"`
	Token   string `json:"token"`
}

type vk struct {
	Confirmation string `json:"confirmation"`
	Token        string `json:"token"`
}

// Config returns current configuration.
var Config config

func init() {
	var configPath string

	root := os.Getenv("RAND_CHAT_ROOT")

	if flag.Lookup("test.v") == nil {
		configPath = path.Join(root, "/config.json")
	} else {
		configPath = path.Join(root, "/config.test.json")
	}

	configFile, err := os.Open(configPath)

	if err != nil {
		panic(err)
	}

	json.NewDecoder(configFile).Decode(&Config)

	Config.Migrations = "file://" + path.Join(root, "/migrations")
}
{'fraction_non_alphanumeric': 0.14931588340273647, 'fraction_numerical': 0.0, 'mean_word_length': 3.5956284153005464, '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': '6834647', 'n_tokens_mistral': 615, 'n_tokens_neox': 593, 'n_words': 147}