conf

package
v0.0.0-...-41bf266 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: CC0-1.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checkout

func Checkout(v interface{}) error

Checkout function takes a reference to a struct or a slice of string. It will traverse both data structures and look up key value pairs in the conf / viper struct by the name of the field for structs and string values for the slice. The function works with pointers so no value is returned. An error is returned if the wrong data structure is provided.

func GetEnv

func GetEnv(key string) string

GetEnv() is a public function that retrieves values stored in conf. If it does not exist, an empty string (i.e., "") is returned. This function will be phased out in later versions of the package.

func LookupEnv

func LookupEnv(key string) (string, bool)

LookupEnv is a public function, like GetEnv, designed to replace os.LookupEnv() in code-base. This function will most likely become a private function in later versions of the package.

func SetEnv

func SetEnv(protect *testing.T, key string, value string) error

SetEnv is a public function that adds key values into conf. This function should only be used either in this package itself or testing. Protect parameter is type *testing.T, and it's there to ensure developers knowingly use it in the appropriate circumstances. This function will most likely become a private function in later versions of the package.

func UnsetEnv

func UnsetEnv(protect *testing.T, key string) error

UnsetEnv is a public function that "unsets" a variable. Like SetEnv, this should only be used either in this package itself or testing. This function will most likely become a private function in later versions of the package.

Types

This section is empty.

Jump to

Keyboard shortcuts

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