config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2025 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultConfDir  = "/etc/aerospike"
	DefaultConfName = "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(...).

func SetDefaultConfDirs

func SetDefaultConfDirs(dirs []string)

SetConfDirs sets the directories to search for the config file when a file name is not explicitly provided. If a file name is explicitly provided viper checks both relative and absolute file paths.

func SetDefaultConfName

func SetDefaultConfName(name string)

SetConfName sets the name of the config file to search for. For aerospike tools this is astools but for asvec it is asvec.

func SetFlags

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

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳