<commit_before>package main

import (
	"errors"
	"fmt"
	"io/ioutil"
	"strings"

	"github.com/hashicorp/hcl"
	"github.com/mitchellh/mapstructure"
)

// Config is used to configure Consul Template
type Config struct {
	// Path is the path to this configuration file on disk. This value is not
	// read from disk by rather dynamically populated by the code so the Config
	// has a reference to the path to the file on disk that created it.
	Path string `mapstructure:"-"`

	// Consul is the location of the Consul instance to query (may be an IP
	// address or FQDN) with port.
	Consul string `mapstructure:"consul"`

	// ConfigTemplates is a slice of the ConfigTemplate objects in the config.
	ConfigTemplates []*ConfigTemplate `mapstructure:"template"`

	// Token is the Consul API token.
	Token string `mapstructure:"token"`

	// Wait
	Wait    *Wait  `mapstructure:"-"`
	WaitRaw string `mapstructure:"wait" json:""`

	// Once runs once and exit as opposed to the default behavior of starting a
	// daemon.
	Once bool `mapstructure:"once"`
}

// Merge merges the values in config into this config object. Values in the
// config object overwrite the values in c.
func (c *Config) Merge(config *Config) error {
	// Since this config is changing from what is loaded on disk, the Path is no
	// longer trustable
	c.Path = ""

	if config.Consul != "" {
		c.Consul = config.Consul
	}

	if len(config.ConfigTemplates) > 0 {
		c.ConfigTemplates = make([]*ConfigTemplate, 0, 1)
		for _, template := range config.ConfigTemplates {
			c.ConfigTemplates = append(c.ConfigTemplates, &ConfigTemplate{
				Source:      template.Source,
				Destination: template.Destination,
				Command:     template.Command,
			})
		}
	}

	if config.Token != "" {
		c.Token = config.Token
	}

	if config.Wait != nil {
		c.Wait = &Wait{
			Min: config.Wait.Min,
			Max: config.Wait.Max,
		}
		c.WaitRaw = config.WaitRaw
	}

	if config.Once {<commit_msg>Do not alter the path - that was a dumb idea<commit_after>package main

import (
	"errors"
	"fmt"
	"io/ioutil"
	"strings"

	"github.com/hashicorp/hcl"
	"github.com/mitchellh/mapstructure"
)

// Config is used to configure Consul Template
type Config struct {
	// Path is the path to this configuration file on disk. This value is not
	// read from disk by rather dynamically populated by the code so the Config
	// has a reference to the path to the file on disk that created it.
	Path string `mapstructure:"-"`

	// Consul is the location of the Consul instance to query (may be an IP
	// address or FQDN) with port.
	Consul string `mapstructure:"consul"`

	// ConfigTemplates is a slice of the ConfigTemplate objects in the config.
	ConfigTemplates []*ConfigTemplate `mapstructure:"template"`

	// Token is the Consul API token.
	Token string `mapstructure:"token"`

	// Wait
	Wait    *Wait  `mapstructure:"-"`
	WaitRaw string `mapstructure:"wait" json:""`

	// Once runs once and exit as opposed to the default behavior of starting a
	// daemon.
	Once bool `mapstructure:"once"`
}

// Merge merges the values in config into this config object. Values in the
// config object overwrite the values in c.
func (c *Config) Merge(config *Config) error {
	if config.Consul != "" {
		c.Consul = config.Consul
	}

	if len(config.ConfigTemplates) > 0 {
		c.ConfigTemplates = make([]*ConfigTemplate, 0, 1)
		for _, template := range config.ConfigTemplates {
			c.ConfigTemplates = append(c.ConfigTemplates, &ConfigTemplate{
				Source:      template.Source,
				Destination: template.Destination,
				Command:     template.Command,
			})
		}
	}

	if config.Token != "" {
		c.Token = config.Token
	}

	if config.Wait != nil {
		c.Wait = &Wait{
			Min: config.Wait.Min,
			Max: config.Wait.Max,
		}
		c.WaitRaw = config.WaitRaw
	}

	if config.Once {
{'fraction_non_alphanumeric': 0.1063264221158958, 'fraction_numerical': 0.001594896331738437, 'mean_word_length': 3.370499419279907, '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': '7261821', 'n_tokens_mistral': 1254, 'n_tokens_neox': 1170, 'n_words': 429}