<commit_before>// Copyright © 2017 Circonus, Inc. <<EMAIL>>
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//

// Package config defines options
package config

import (
	"encoding/json"
	"expvar"
	"fmt"
	"io"

	"github.com/circonus-labs/circonus-agent/internal/config/defaults"
	toml "github.com/pelletier/go-toml"
	"github.com/pkg/errors"
	"github.com/spf13/viper"
	yaml "gopkg.in/yaml.v2"
)

// Log defines the running config.log structure
type Log struct {
	Level  string `json:"level" yaml:"level" toml:"level"`
	Pretty bool   `json:"pretty" yaml:"pretty" toml:"pretty"`
}

// API defines the running config.api structure
type API struct {
	App    string `json:"app" yaml:"app" toml:"app"`
	CAFile string `mapstructure:"ca_file" json:"ca_file" yaml:"ca_file" toml:"ca_file"`
	Key    string `json:"key" yaml:"key" toml:"key"`
	URL    string `json:"url" yaml:"url" toml:"url"`
}

// ReverseCreateCheckOptions defines the running config.reverse.check structure
type ReverseCreateCheckOptions struct {
	Broker string `json:"broker" yaml:"broker" toml:"broker"`
	Tags   string `json:"tags" yaml:"tags" toml:"tags"`
	Title  string `json:"title" yaml:"title" toml:"title"`
}

// Check defines the check parameters
type Check struct {
	Broker           string `json:"broker" yaml:"broker" toml:"broker"`
	BundleID         string `mapstructure:"bundle_id" json:"bundle_id" yaml:"bundle_id" toml:"bundle_id"`
	Create           bool   `mapstructure:"create" json:"create" yaml:"create" toml:"create"`
	EnableNewMetrics bool   `mapstructure:"enable_new_metrics" json:"enable_new_metrics" yaml:"enable_new_metrics" toml:"enable_new_metrics"`
	MetricFilters    string `mapstructure:"metric_filters" json:"metric_filters" yaml:"metric_filters" toml:"metric_filters"` // needs to be json embedded in a string because rules are positional
	MetricStateDir   string `mapstructure:"metric_state_dir" json:"metric_state_dir" yaml:"metric_state_dir" toml:"metric_state_dir"`
	MetricRefreshTTL string `mapstructure:"metric_refresh_ttl" json:"metric_refresh_ttl" yaml:"metric_refresh_ttl" toml:"metric_refresh_ttl"`
	MetricStreamtags bool   `mapstructure:"metric_streamtags" json:"metric_streamtags" yaml:"metric_streamtags" toml:"metric_streamtags"`
	Tags             string `json:"tags" yaml:"tags" toml:"tags"`
	Target           string `mapstructure:"target" json:"target" yaml:"target" toml:"target"`
	Title            string `json:"title" yaml:"title" toml:"title"`
}

// Reverse defines the running config.reverse structure
type Reverse struct {
	BrokerCAFile string `mapstructure:"broker_ca_file" json:"broker_ca_file" yaml:"broker_ca_file" toml:"broker_ca_file"`
	Enabled      bool   `json:"enabled" yaml:"enabled" toml:"enabled"`
	MaxConnRetry int    `mapstructure:"max_conn_retry" json:"max_conn_retry" yaml:"max_conn_retry" toml:"max_conn_retry"`
}

// SSL defines the running config.ssl structure
type SSL struct {
	CertFile string `mapstructure:"cert_file" json:"cert_file" yaml:"cert_file" toml:"cert_file"`
	KeyFile  string `mapstructure:"key_file" json:"key_file" yaml:"key_file" toml:"key_file"`
	Listen   string `json:"listen" yaml:"listen" toml:"listen"`<commit_msg>upd: hide deprecated settings in config file (`--show-config`)<commit_after>// Copyright © 2017 Circonus, Inc. <<EMAIL>>
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//

// Package config defines options
package config

import (
	"encoding/json"
	"expvar"
	"fmt"
	"io"

	"github.com/circonus-labs/circonus-agent/internal/config/defaults"
	toml "github.com/pelletier/go-toml"
	"github.com/pkg/errors"
	"github.com/spf13/viper"
	yaml "gopkg.in/yaml.v2"
)

// Log defines the running config.log structure
type Log struct {
	Level  string `json:"level" yaml:"level" toml:"level"`
	Pretty bool   `json:"pretty" yaml:"pretty" toml:"pretty"`
}

// API defines the running config.api structure
type API struct {
	App    string `json:"app" yaml:"app" toml:"app"`
	CAFile string `mapstructure:"ca_file" json:"ca_file" yaml:"ca_file" toml:"ca_file"`
	Key    string `json:"key" yaml:"key" toml:"key"`
	URL    string `json:"url" yaml:"url" toml:"url"`
}

// ReverseCreateCheckOptions defines the running config.reverse.check structure
type ReverseCreateCheckOptions struct {
	Broker string `json:"broker" yaml:"broker" toml:"broker"`
	Tags   string `json:"tags" yaml:"tags" toml:"tags"`
	Title  string `json:"title" yaml:"title" toml:"title"`
}

// Check defines the check parameters
type Check struct {
	Broker           string `json:"broker" yaml:"broker" toml:"broker"`
	BundleID         string `mapstructure:"bundle_id" json:"bundle_id" yaml:"bundle_id" toml:"bundle_id"`
	Create           bool   `mapstructure:"create" json:"create" yaml:"create" toml:"create"`
	MetricFilters    string `mapstructure:"metric_filters" json:"metric_filters" yaml:"metric_filters" toml:"metric_filters"` // needs to be json embedded in a string because rules are positional
	MetricRefreshTTL string `mapstructure:"metric_refresh_ttl" json:"metric_refresh_ttl" yaml:"metric_refresh_ttl" toml:"metric_refresh_ttl"`
	MetricStreamtags bool   `mapstructure:"metric_streamtags" json:"metric_streamtags" yaml:"metric_streamtags" toml:"metric_streamtags"`
	Tags             string `json:"tags" yaml:"tags" toml:"tags"`
	Target           string `mapstructure:"target" json:"target" yaml:"target" toml:"target"`
	Title            string `json:"title" yaml:"title" toml:"title"`
	// hide deprecated config settings
	EnableNewMetrics bool   `json:"-" yaml:"-" toml:"-"`
	MetricStateDir   string `json:"-" yaml:"-" toml:"-"`
}

// Reverse defines the running config.reverse structure
type Reverse struct {
	BrokerCAFile string `mapstructure:"broker_ca_file" json:"broker_ca_file" yaml:"broker_ca_file" toml:"broker_ca_file"`
	Enabled      bool   `json:"enabled" yaml:"enabled" toml:"enabled"`
	MaxConnRetry int    `mapstructure:"max_conn_retry" json:"max_conn_retry" yaml:"max_conn_retry" toml:"max_conn_retry"`
}

// SSL defines the running config.ssl structure
type SSL struct {
	CertFile string `mapstructure:"cert_file" json:"cert_file" yaml:"cert_file" toml:"cert_file"`
	KeyFile  string `mapstructure:"key_file" json:"key_file" yaml:"key_file" toml:"key_file"`
	Listen   string `json:"listen" yaml:"listen" toml:"listen"`
{'fraction_non_alphanumeric': 0.1334589417490972, 'fraction_numerical': 0.002198147275867483, 'mean_word_length': 5.5602471678681775, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1971731', 'n_tokens_mistral': 2105, 'n_tokens_neox': 2027, 'n_words': 512}