config

package
v0.0.0-...-ec95f82 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIntKey

func GetIntKey(key string) int

func GetIntKeyWithDefault

func GetIntKeyWithDefault(key string, defaultValue int) int

func GetKey

func GetKey(key string) string

func GetKeyWithDefault

func GetKeyWithDefault(key, defaultValue string) string

func Load

func Load() error

func LoadFromPath

func LoadFromPath(path string) error

func MustGetIntKey

func MustGetIntKey(key string) int

func MustGetKey

func MustGetKey(key string) string

func SetConfig

func SetConfig(c Configer)

Types

type Configer

type Configer interface {
	LoadFromPath(path string) error
	Load() error
	GetKey(key string) string
	MustGetKey(key string) string
	GetKeyWithDefault(key, defaultValue string) string
	GetIntKey(key string) int
	MustGetIntKey(key string) int
	GetIntKeyWithDefault(key string, defaultValue int) int
}

func GetConfig

func GetConfig() Configer

type DotenvConfig

type DotenvConfig struct {
	DotenvPath string
}

func NewDotenvConfig

func NewDotenvConfig(path string) *DotenvConfig

func (*DotenvConfig) GetIntKey

func (c *DotenvConfig) GetIntKey(key string) int

func (*DotenvConfig) GetIntKeyWithDefault

func (c *DotenvConfig) GetIntKeyWithDefault(key string, defaultValue int) int

func (*DotenvConfig) GetKey

func (c *DotenvConfig) GetKey(key string) string

func (*DotenvConfig) GetKeyWithDefault

func (c *DotenvConfig) GetKeyWithDefault(key, defaultValue string) string

func (*DotenvConfig) Load

func (c *DotenvConfig) Load() error

func (*DotenvConfig) LoadFromPath

func (c *DotenvConfig) LoadFromPath(path string) error

func (*DotenvConfig) MustGetIntKey

func (c *DotenvConfig) MustGetIntKey(key string) int

func (*DotenvConfig) MustGetKey

func (c *DotenvConfig) MustGetKey(key string) string

type MapConfig

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

func NewMapConfig

func NewMapConfig(entries map[string]string) *MapConfig

func (*MapConfig) GetIntKey

func (c *MapConfig) GetIntKey(key string) int

func (*MapConfig) GetIntKeyWithDefault

func (c *MapConfig) GetIntKeyWithDefault(key string, defaultValue int) int

func (*MapConfig) GetKey

func (c *MapConfig) GetKey(key string) string

func (*MapConfig) GetKeyWithDefault

func (c *MapConfig) GetKeyWithDefault(key, defaultValue string) string

func (*MapConfig) Load

func (c *MapConfig) Load() error

func (*MapConfig) LoadFromPath

func (c *MapConfig) LoadFromPath(_ string) error

func (*MapConfig) MustGetIntKey

func (c *MapConfig) MustGetIntKey(key string) int

func (*MapConfig) MustGetKey

func (c *MapConfig) MustGetKey(key string) string

Jump to

Keyboard shortcuts

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