config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(key string, fallback ...interface{}) interface{}

Get retrieves a configuration value from the singleton instance

func MustEnv

func MustEnv[T any](key string, fallback T) T

MustEnv retrieves an environment variable and converts it to the specified type or panics on failure

func Set

func Set(key string, value interface{})

Set sets a configuration value in the singleton instance

Types

type Configuration

type Configuration interface {
	SetConfigMap(cm M) *config
	Set(key string, value interface{})
	Get(key string, fallback ...interface{}) interface{}
	GetAll() M
}

func GetInstance

func GetInstance() Configuration

GetInstance returns the singleton instance of config

type M

type M map[string]interface{}

M is a type alias for a map of string to interface{}

func GetAll

func GetAll() M

GetAll returns all configurations from the singleton instance

Jump to

Keyboard shortcuts

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