config

package
v0.0.0-...-766ab8f Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	AsToolsConfDir  = "/etc/aerospike"
	AsToolsConfName = "astools"
)

Variables

This section is empty.

Functions

func BindPFlags

func BindPFlags(flags *pflag.FlagSet, section string)

BindPFlags binds the flags to viper. Should be called after the flag set is created. The section is prepended to the flag name to create the viper key. For example, if the config is found under the "cluster" section then we will bind "cluster.host" to the flag "host". If the section is empty then the flag name is used as the key.

func InitConfig

func InitConfig(userProvidedCfgFile, instance string, flags *pflag.FlagSet) (string, error)

InitConfig reads in config file and ENV variables if set. Should be called from the root commands PersistentPreRunE function with the flags of the current command.

func Reset

func Reset()

Reset resets the global configToFlagMap and viper instance. Should be called before or after tests that use InitConfig or BindPFlags. If using testify suites call it in the SetupTest function and or SetupSubTests if using suite.T().Run(...).

Types

This section is empty.

Jump to

Keyboard shortcuts

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