config

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// config file defaults
	DEF_CFG_DIR   = `/etc/susetelemetry`
	DEF_CFG_FILE  = `telemetry.yaml`
	DEF_CFG_PATH  = DEF_CFG_DIR + `/` + DEF_CFG_FILE
	DEF_CFG_USER  = `susetelm`
	DEF_CFG_GROUP = `susetelm`
	DEF_CFG_PERM  = 0640

	// config defaults
	DEF_CFG_ENABLED     = false
	DEF_CFG_BASE_URL    = `https://scc.suse.com/telemetry/`
	DEF_CFG_CLIENT_ID   = ``
	DEF_CFG_CUSTOMER_ID = ``

	// data store defaults
	DEF_CFG_DB_DRIVER = `sqlite3`
	DEF_CFG_DB_DIR    = `/var/lib/` + DEF_CFG_USER + `/client`
	DEF_CFG_DB_FILE   = `telemetry.db`
	DEF_CFG_DB_PATH   = DEF_CFG_DB_DIR + `/` + DEF_CFG_DB_FILE

	// logging defaults
	DEF_CFG_LOG_LEVEL    = `info`
	DEF_CFG_LOG_LOCATION = `stderr`
	DEF_CFG_LOG_STYLE    = `text`

	// class defaults
	DEF_CFG_OPT_OUT = true
	DEF_CFG_OPT_IN  = false
)

Variables

This section is empty.

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"`
}

telemetry class options configuration

func (*ClassOptionsConfig) String

func (cc *ClassOptionsConfig) String() string

type Config

type Config struct {
	TelemetryBaseURL string             `yaml:"telemetry_base_url"`
	Enabled          bool               `yaml:"enabled"`
	ClientId         string             `yaml:"client_id"`
	CustomerId       string             `yaml:"customer_id"`
	Tags             types.Tags         `yaml:"tags"`
	DataStores       DBConfig           `yaml:"datastores"`
	ClassOptions     ClassOptionsConfig `yaml:"class_options"`
	Logging          LogConfig          `yaml:"logging"`
	Extras           any                `yaml:"extras,omitempty"`
	// contains filtered or unexported fields
}

func NewConfig

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

func NewDefaultConfig

func NewDefaultConfig() *Config

func (*Config) ConfigDir

func (c *Config) ConfigDir() string

func (*Config) ConfigGroup

func (c *Config) ConfigGroup() string

func (*Config) ConfigName

func (c *Config) ConfigName() string

func (*Config) ConfigPath

func (c *Config) ConfigPath() string

func (*Config) ConfigUser

func (c *Config) ConfigUser() string

func (*Config) Load

func (cfg *Config) Load() (err error)

func (*Config) Save

func (cfg *Config) Save() (err error)

func (*Config) String

func (c *Config) String() string

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 provided telemetry data

func (*DBConfig) String

func (dc *DBConfig) String() string

type LogConfig

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

logging config

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