config

package
v0.0.0-...-e8f2edf Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCfg = Config{

	TelemetryBaseURL: "http://localhost:9999/telemetry",
	Enabled:          false,
	CustomerID:       "0",
	Tags:             []string{},
	DataStores:       DefaultDBCfg,
	Logging:          DefaultLogging,
	ClassOptions:     DefaultClassOptions,
}
View Source
var DefaultClassOptions = ClassOptionsConfig{
	OptOut: true,
	OptIn:  false,
	Allow:  []types.TelemetryType{},
	Deny:   []types.TelemetryType{},
}
View Source
var DefaultDBCfg = DBConfig{
	Driver: "sqlite3",
	Params: "/tmp/telemetry/client/telemetry.db",
}

Defaults

View Source
var DefaultLogging = LogConfig{
	Level:    "info",
	Location: "stderr",
	Style:    "text",
}

Functions

This section is empty.

Types

type ClassOptionsConfig

type ClassOptionsConfig struct {
	OptOut bool                  `yaml:"opt_out" json:"opt_out"`
	OptIn  bool                  `yaml:"opt_in" json:"opt_in"`
	Allow  []types.TelemetryType `yaml:"allow" json:"allow"`
	Deny   []types.TelemetryType `yaml:"deny" json:"deny"`
}

type Config

type Config struct {
	TelemetryBaseURL string             `yaml:"telemetry_base_url"`
	Enabled          bool               `yaml:"enabled"`
	CustomerID       string             `yaml:"customer_id"`
	Tags             []string           `yaml:"tags"`
	DataStores       DBConfig           `yaml:"datastores"`
	ClassOptions     ClassOptionsConfig `yaml:"classOptions"`
	Logging          LogConfig          `yaml:"logging"`
	Extras           any                `yaml:"extras,omitempty"`
}

func NewConfig

func NewConfig(cfgFile string) (*Config, error)

func (*Config) TelemetryClassEnabled

func (c *Config) TelemetryClassEnabled(class types.TelemetryClass) bool

func (*Config) TelemetryTypeEnabled

func (c *Config) TelemetryTypeEnabled(telemetry types.TelemetryType) bool

type DBConfig

type DBConfig struct {
	Driver string `yaml:"driver"`
	Params string `yaml:"params"`
}

Datastore config for staging the data

type LogConfig

type LogConfig struct {
	Level    string `yaml:"level" json:"level"`
	Location string `yaml:"location" json:"location"`
	Style    string `yaml:"style" json:"style"`
}

func (*LogConfig) String

func (lc *LogConfig) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL