config

package
v0.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2025 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CurrentContextSetting   = "current-context"
	DisableReportingSetting = "disable-reporting"
)

Variables

View Source
var Version = "dev"

Version is the current version of the grr command. To be overwritten at build time

Functions

func CreateContext

func CreateContext(name string) error

func Get added in v0.4.0

func Get(path, outputFormat string) (string, error)

func GetContexts

func GetContexts() ([]string, error)

func Hash added in v0.6.0

func Hash() (string, error)

func Import

func Import() error

func Initialise

func Initialise()

func Mock

func Mock(values map[string]interface{})

func NewConfig

func NewConfig()

func Read

func Read() error

func Set

func Set(path string, value string) error

func Unset added in v0.4.2

func Unset(path string) error

func UsageStatsDisabled added in v0.6.0

func UsageStatsDisabled() bool

func UseContext

func UseContext(context string) error

func Write

func Write() error

Types

type Context

type Context struct {
	Name                string                    `yaml:"name" mapstructure:"name"`
	Grafana             GrafanaConfig             `yaml:"grafana" mapstructure:"grafana"`
	Mimir               MimirConfig               `yaml:"mimir" mapstructure:"mimir"`
	SyntheticMonitoring SyntheticMonitoringConfig `yaml:"synthetic-monitoring" mapstructure:"synthetic-monitoring"`
	Targets             []string                  `yaml:"targets" mapstructure:"targets"`
	OutputFormat        string                    `yaml:"output-format" mapstructure:"output-format"`
	OnlySpec            bool                      `yaml:"only-spec" mapstructure:"only-spec"`
	ResourceKind        string                    `yaml:"resource-kind" mapstructure:"resource-kind"`
	FolderUID           string                    `yaml:"folder-uid" mapstructure:"folder-uid"`
}

func CurrentContext

func CurrentContext() (*Context, error)

func (*Context) GetTargets added in v0.3.1

func (c *Context) GetTargets(overrides []string) []string

func (Context) Secrets added in v0.6.1

func (c Context) Secrets() []string

Secrets returns all the secrets contained in the current context. This is mainly useful to be able to redact those from logs.

type GrafanaConfig

type GrafanaConfig struct {
	URL                string `yaml:"url" mapstructure:"url"`
	User               string `yaml:"user" mapstructure:"user"`
	Token              string `yaml:"token" mapstructure:"token"`
	InsecureSkipVerify bool   `yaml:"insecure-skip-verify" mapstructure:"insecure-skip-verify"`
	TLSHost            string `yaml:"tls-host" mapstructure:"tls-host"`
}

type MimirConfig

type MimirConfig struct {
	Address   string         `yaml:"address" mapstructure:"address"`
	TenantID  string         `yaml:"tenant-id" mapstructure:"tenant-id"`
	APIKey    string         `yaml:"api-key" mapstructure:"api-key"`
	TLS       MimirTLSConfig `yaml:"tls" mapstructure:"tls"`
	AuthToken string         `yaml:"auth-token" mapstructure:"auth-token"`
}

type MimirTLSConfig added in v0.4.2

type MimirTLSConfig struct {
	ClientCertPath string `yaml:"client-cert-path,omitempty" mapstructure:"client-cert-path"`
	ClientKeyPath  string `yaml:"client-key-path,omitempty" mapstructure:"client-key-path"`
	CAPath         string `yaml:"ca-path" mapstructure:"ca-path"`
}

type SyntheticMonitoringConfig

type SyntheticMonitoringConfig struct {
	URL string `yaml:"url" mapstructure:"url"`
	// SM can be configured with a metrics publisher token (and various stack information) or an access token gotten from the UI
	Token       string `yaml:"token" mapstructure:"token"`
	StackID     int64  `yaml:"stack-id" mapstructure:"stack-id"`
	LogsID      int64  `yaml:"logs-id" mapstructure:"logs-id"`
	MetricsID   int64  `yaml:"metrics-id" mapstructure:"metrics-id"`
	AccessToken string `yaml:"access-token" mapstructure:"access-token"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳