Documentation ¶
Overview ¶
Copyright 2022-2023 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0
Copyright 2023 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0
Copyright 2022-2023 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0
Copyright 2022-2023 Contributors to the Veraison project. SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( DisplayVersion *bool = flag.BoolP("version", "v", false, "print version and exit") DisplayHelp *bool = flag.BoolP("help", "h", false, "print help and exit") File *string = flag.StringP("config", "c", "config.yaml", "configuration file") )
Veraison services common command line flags: -c, --config <configuration-file> (default "config.yaml") -h, --help -v, --version
var Developer = "Veraison Project"
var ErrNilConfig = errors.New("nil configuration")
var SchemeLoader = "plugins"
Valid values: "plugins", "builtin"
var Version = "N/A"
Functions ¶
func GetSubs ¶
GetSubs returns a map of name onto the corresponding Sub from the provided Viper, ensuring that it is never nil. If the provided Viper does not contain the specified Sub (v.Sub(name) returns nil), an error will be returned, unless the name is specified as optional by prefixing it with "*", in which case a new empty Viper is returned instead.
func ReadRawConfig ¶
ReadRawConfig instantiates a Viper and uses it to read in configuration. If path is specified as something other than an empty string, Viper will attempt to read it, inferring the format from the file extension. Otherwise, it will for a file called "config.yaml" inside current working directory. An error will be returned if there are problems reading configuration. Unless allowNotFount is set to true, this includes the config file (either the explicitly specified one or the implicit config.yaml) not being present.
Types ¶
type IValidatable ¶
type IValidatable interface {
Validate() error
}
IValidatable defines an interface of objects that can self-validate.
type Loader ¶
type Loader struct {
// contains filtered or unexported fields
}
Loader is responsible for loading config from a source into a struct instance.
func NewLoader ¶
func NewLoader(dest interface{}) *Loader
NewLoader creates a new loader. dest must be a pointer to a struct instance to be populated, other wise, nil returned.
func NewNonExclusiveLoader ¶
func NewNonExclusiveLoader(dest interface{}) *Loader
NewNonExclusiveLoader is just like NewLoader, but the loader returned allows ther to be unknown settings in the source.
func (*Loader) Init ¶
Init initializes the loader with the specified destination. If dest is not a pointer to a struct instance, an error is returned.
func (Loader) LoadFromMap ¶
LoadFromMap populates the destination struct instance with values from the specified map[string]interface{} source.