application

package
v0.21.1-0...-a3b014d Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

Variables

View Source
var ConfigSearchLocations = []string{
	fmt.Sprintf(".%s.yaml", Name),
	fmt.Sprintf("%s.yaml", Name),
	fmt.Sprintf(".%s/config.yaml", Name),
	fmt.Sprintf("~/.%s.yaml", Name),
	fmt.Sprintf("~/%s.yaml", Name),
	fmt.Sprintf("$XDG_CONFIG_HOME/%s/config.yaml", Name),
}

Functions

This section is empty.

Types

type Application

type Application struct {
	Config *Config
	// contains filtered or unexported fields
}

func New

func New() *Application

func (Application) Run

func (a Application) Run(ctx context.Context, errs <-chan error) error

func (*Application) Setup

func (a *Application) Setup(opts options.Interface) func(cmd *cobra.Command, args []string) error

type BuildInfo

type BuildInfo struct {
	Version        string `json:"version"`        // application semantic version
	GitCommit      string `json:"gitCommit"`      // git SHA at build-time
	GitDescription string `json:"gitDescription"` // indication of git tree (either "clean" or "dirty") at build-time
	BuildDate      string `json:"buildDate"`      // date of the build
	GoVersion      string `json:"goVersion"`      // go runtime version at build-time
	Compiler       string `json:"compiler"`       // compiler used at build-time
	Platform       string `json:"platform"`       // GOOS and GOARCH at build-time
	DBSchema       int    `json:"dbSchema"`
}

func ReadBuildInfo

func ReadBuildInfo() BuildInfo

type Cache

type Cache struct {
	Directory string `yaml:"dir" json:"dir" mapstructure:"dir"`
}

type Config

type Config struct {
	ConfigPath string `yaml:"config,omitempty" json:"config"` // the location where the application config was read from (either from -c or discovered while loading)

	Dev Development `yaml:"dev" json:"dev" mapstructure:"dev"`
	Log Logging     `yaml:"log" json:"log" mapstructure:"log"` // all logging-related options

	DisableLoadFromDisk bool `yaml:"-" json:"-" mapstructure:"-"`
	DryRun              bool `yaml:"-" json:"-" mapstructure:"dry-run"`
}

func (*Config) BindFlags

func (cfg *Config) BindFlags(flags *pflag.FlagSet, v *viper.Viper) error

func (*Config) Load

func (cfg *Config) Load(v *viper.Viper) error

Load populates the given viper object with application configuration discovered on disk

func (Config) String

func (cfg Config) String() string

type Development

type Development struct {
	ProfileCPU bool `yaml:"profile-cpu" json:"profile-cpu" mapstructure:"profile-cpu"`
	ProfileMem bool `yaml:"profile-mem" json:"profile-mem" mapstructure:"profile-mem"`
}

type Logging

type Logging struct {
	Quiet        bool         `yaml:"quiet" json:"quiet" mapstructure:"quiet" description:"suppress logging output"`         // -q, indicates to not show any status output to stderr
	Verbosity    int          `yaml:"-" json:"-" mapstructure:"verbosity"`                                                   // -v or -vv , controlling which UI (ETUI vs logging) and what the log level should be
	Level        logger.Level `yaml:"level" json:"level" mapstructure:"level" description:"error, warn, info, debug, trace"` // the log level string hint
	FileLocation string       `yaml:"file" json:"file" mapstructure:"file" description:"file to write all loge entries to"`  // the file path to write logs to

}

Logging contains all logging-related configuration options available to the user via the application config.

Jump to

Keyboard shortcuts

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