config

package
v1.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfigValues = AppConfig{
	Log: Logging{
		Level:        "",
		FileLocation: "",
	},
	AnchoreDetails: connection.AnchoreInfo{
		Account: "admin",
		HTTP: connection.HTTPConfig{
			Insecure:       false,
			TimeoutSeconds: 10,
		},
	},
	Region:                 "",
	PollingIntervalSeconds: 300,
	Quiet:                  false,
	DryRun:                 false,
}
View Source
var ErrConfigFileNotFound = fmt.Errorf("application config file not found")

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Log                    Logging `mapstructure:"log"`
	CliOptions             CliOnlyOptions
	PollingIntervalSeconds int                    `mapstructure:"polling-interval-seconds"`
	AnchoreDetails         connection.AnchoreInfo `mapstructure:"anchore"`
	Region                 string                 `mapstructure:"region"`
	Quiet                  bool                   `mapstructure:"quiet"`   // if true do not log the inventory report to stdout
	DryRun                 bool                   `mapstructure:"dry-run"` // if true do not report inventory to Anchore
}

func LoadConfigFromFile

func LoadConfigFromFile(v *viper.Viper, cliOpts *CliOnlyOptions) (*AppConfig, error)

Load the Application Configuration from the Viper specifications

func (*AppConfig) Build

func (cfg *AppConfig) Build() error

Build the configuration object (to be used as a singleton)

func (AppConfig) String

func (cfg AppConfig) String() string

type CliOnlyOptions

type CliOnlyOptions struct {
	ConfigPath string
	Verbosity  int
}

Configuration options that may only be specified on the command line

type Logging

type Logging struct {
	Level        string `mapstructure:"level"`
	FileLocation string `mapstructure:"file"`
}

Logging Configuration

Jump to

Keyboard shortcuts

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