config

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filename added in v0.7.1

func Filename() string

Filename returns the name of the file that the configuration is using.

func Get added in v0.2.0

func Get(key string) interface{}

Get returns an uncasted value from the config map.

func GetDuration added in v0.2.0

func GetDuration(key string) time.Duration

GetDuration returns a duration from the config map.

func GetEnclave added in v0.2.0

func GetEnclave(key string) *memguard.Enclave

GetEnclave returns an enclave from the config map.

func GetString added in v0.2.0

func GetString(key string) string

GetString returns a string from the config map.

func GetStringMapString added in v0.4.0

func GetStringMapString(key string) map[string]string

GetStringMapString returns a map[string]string from the config map.

func GetUint32 added in v0.2.0

func GetUint32(key string) uint32

GetUint32 returns an uint32 from the config map.

func Init added in v0.2.0

func Init() error

Init intializes the configuration.

func IsSet added in v0.2.0

func IsSet(key string) bool

IsSet returns if the key exists in the config map or not.

func Load

func Load(configPath string) error

Load reads the configuration file and populates the map.

func Reset added in v0.2.0

func Reset()

Reset sets config to its initial value.

func Set added in v0.2.0

func Set(key string, value interface{})

Set sets a value to the config map.

func SetDefaults added in v0.2.0

func SetDefaults(dbPath string)

SetDefaults populates the config map with the default values.

func SetFilename added in v0.7.1

func SetFilename(filename string)

SetFilename sets the configuration filename.

func Write added in v0.2.0

func Write(filename string, exclusive bool) error

Write encodes and writes the config map to the specified file.

If exclusive is true an error will be returned if the file already exists, otherwise it will truncate the file and write to it.

func WriteStruct added in v0.2.0

func WriteStruct(filename string) error

WriteStruct writes the configuration empty structure to the given file.

Types

type Config added in v0.2.0

type Config struct {
	// contains filtered or unexported fields
}

Config contains the elements for handling the configuration.

func New added in v0.2.0

func New() *Config

New returns a new Config.

func (*Config) Get added in v0.2.0

func (c *Config) Get(key string) interface{}

Get the value mapped to the specified key.

func (*Config) Load added in v0.2.0

func (c *Config) Load(filename string) error

Load reads the file and populates the config map.

func (*Config) Set added in v0.2.0

func (c *Config) Set(key string, value interface{})

Set sets a value for the key passed.

func (*Config) Write added in v0.2.0

func (c *Config) Write(filename string, flags int) error

Write creates a new file and writes the configuration map content to it.

Jump to

Keyboard shortcuts

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