config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSettingValue

func GetSettingValue(name string) any

func Load

func Load()

func Reset

func Reset() error

func SettingNames

func SettingNames() []string

func UpdateSettingValue

func UpdateSettingValue(name string, value string) error

func ValidArgSettingName

func ValidArgSettingName(cmdName string) func(cmd *cobra.Command, args []string) error

Types

type Config

type Config struct {
	URL           string            `yaml:"url" json:"url" validate:"required"`
	APIKey        string            `yaml:"api_key" json:"api_key" validate:"required"`
	APISecret     string            `yaml:"api_secret" json:"api_secret" validate:"required"`
	Labels        map[string]string `yaml:"labels" json:"labels" validate:"required"`
	Rate          int               `yaml:"rate" json:"rate" validate:"required"`
	Timeout       time.Duration     `yaml:"timeout" json:"timeout" validate:"required"`
	LogConfig     LogConfig         `yaml:"log_config" json:"log_config" validate:"required"`
	EnableMetrics bool              `yaml:"enable_metrics" json:"enable_metrics"`
	EnableTraces  bool              `yaml:"enable_traces" json:"enable_traces"`
}

func Get

func Get() *Config

func (Config) MarshalEasyJSON

func (v Config) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Config) MarshalJSON

func (v Config) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Config) UnmarshalEasyJSON

func (v *Config) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Config) UnmarshalJSON

func (v *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type DetailedLogConfig

type DetailedLogConfig struct {
	Format    string    `json:"format"`
	Structure []LogInfo `json:"structure"`
}

func (DetailedLogConfig) MarshalEasyJSON

func (v DetailedLogConfig) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (DetailedLogConfig) MarshalJSON

func (v DetailedLogConfig) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*DetailedLogConfig) UnmarshalEasyJSON

func (v *DetailedLogConfig) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DetailedLogConfig) UnmarshalJSON

func (v *DetailedLogConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type LogConfig

type LogConfig struct {
	Format    string            `yaml:"format" json:"format" validate:"oneof=logfmt json"`
	Structure map[string]string `yaml:"structure" json:"structure" validate:"required"`
}

func (*LogConfig) Detailed

func (lc *LogConfig) Detailed(categories ...string) *DetailedLogConfig

func (LogConfig) MarshalEasyJSON

func (v LogConfig) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LogConfig) MarshalJSON

func (v LogConfig) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LogConfig) UnmarshalEasyJSON

func (v *LogConfig) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LogConfig) UnmarshalJSON

func (v *LogConfig) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type LogInfo

type LogInfo struct {
	Display     string           `json:"display"`
	Category    string           `json:"category"`
	Description string           `json:"description"`
	Example     string           `json:"example"`
	Params      []gofakeit.Param `json:"params"`
}

func (LogInfo) MarshalEasyJSON

func (v LogInfo) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LogInfo) MarshalJSON

func (v LogInfo) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LogInfo) UnmarshalEasyJSON

func (v *LogInfo) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LogInfo) UnmarshalJSON

func (v *LogInfo) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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