config

package
v2.10.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear()

Clear unloads the config. DANGEROUS, should only be used for testing.

func Get

func Get(key string) interface{}

Get a config entry

func GetBool

func GetBool(key string) bool

GetBool a config entry as bool

func GetString

func GetString(key string) string

GetString a config entry as string

func Has added in v2.5.0

func Has(key string) bool

Has check if a config entry exists.

func IsLoaded

func IsLoaded() bool

IsLoaded returns true if the config have been loaded.

func Load

func Load() error

Load loads the config.json file in the current working directory. If the "GOYAVE_ENV" env variable is set, the config file will be picked like so: - "production": "config.production.json" - "test": "config.test.json" - By default: "config.json"

func Register added in v2.5.0

func Register(key string, kind reflect.Kind)

Register a config entry for validation. If the entry identified by the given key is set or modified, its value will be validated according to the given kind. If the entry already exists, it will be revalidated.

This method doesn't allow to override existing validation. Once an entry is registered, its expected kind cannot be modified.

func Set

func Set(key string, value interface{})

Set a config entry

The change is temporary and will not be saved for next boot.

Types

This section is empty.

Jump to

Keyboard shortcuts

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