fig

package module
v0.0.0-...-372e2ce Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: MIT Imports: 12 Imported by: 7

README

fig

reading and loading configuration from yaml / json files

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnvironmentOrder = []string{"prod", "dev", "config"}
View Source
var ExtensionOrder = []string{".yaml", ".json"}
View Source
var FolderOrder = []string{"./config/", ""}
View Source
var ShowFiles = true

ShowFiles if set to true, will output the files to StdOut which were read to build the overall configuration

Functions

func Bool

func Bool(keys ...string) bool

Bool returns the bool value at the given key. Panics if the key is missing.

func BoolOr

func BoolOr(defaultVal bool, keys ...string) bool

BoolOr returns the bool value at the given key. If key is missing it returns defaultVal

func Exists

func Exists(keys ...string) bool

Exists checks if the given key is present. It also loads configuration (if missing)

func Float

func Float(keys ...string) float64

Float returns the float value at the given key. Panics if the key is missing.

func FloatOr

func FloatOr(defaultVal float64, keys ...string) float64

FloatOr returns the float64 value at the given key. If key is missing it returns defaultVal

func Int

func Int(keys ...string) int

Int returns the int value at the given key. Panics if the key is missing.

func IntOr

func IntOr(defaultVal int, keys ...string) int

IntOr returns the int value at the given key. If key is missing it returns defaultVal

func Interface

func Interface(keys ...string) interface{}

Interface returns the generic value corresponding to a key.

func Map

func Map(keys ...string) map[string]interface{}

Map returns a map a the given key. Panics if the key is missing.

func MustExist

func MustExist(key string)

MustExist panics if the given configuration key is missing

func Reset

func Reset()

Reset loads the configuration

func String

func String(keys ...string) string

String returns the string value at the given key. Panics if the key is missing.

func StringOr

func StringOr(defaultVal string, keys ...string) string

StringOr returns the string value at the given key. If key is missing it returns defaultVal

func StringSlice

func StringSlice(keys ...string) []string

StringSlice returns a splice of string at the given key. Panics if the key is not present.

func StringSliceOr

func StringSliceOr(defaultVal []string, keys ...string) []string

StringSliceOr returns a splice of string at the given key. If key is missing it returns defaultVal.

func Struct

func Struct(addr interface{}, keys ...string)

Struct is used to parse and load simple structures. Most common use is reading connection strings. Note that it does not work for nested structs or arrays

Types

This section is empty.

Jump to

Keyboard shortcuts

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