configuration

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBoolEnv

func GetBoolEnv(key string, fallback bool) bool

Get environment variable value as boolean

func GetEnv

func GetEnv(key, fallback string) string

Get environment variable value as string

func GetInt64Env

func GetInt64Env(key string, fallback int64) int64

Get environment variable value as int64

func GetIntEnv

func GetIntEnv(key string, fallback int) int

Get environment variable value as int

Types

type Cfg

type Cfg struct {
}

Configuration object with usefull methods

func (Cfg) Get

func (c Cfg) Get(key string) string

Get - Get environment variable value or "" if not exists

func (Cfg) GetBool

func (c Cfg) GetBool(key string) bool

GetBoolEnv - Get an boolean env var. This returns false to invalid values

func (Cfg) GetBoolF added in v0.0.1

func (c Cfg) GetBoolF(key string, fallback bool) bool

GetBoolEnv - Get an boolean environment var with default value. This returns false to invalid values

func (Cfg) GetF added in v0.0.1

func (c Cfg) GetF(key, fallback string) string

func (Cfg) GetInt

func (c Cfg) GetInt(key string) int

func (Cfg) GetInt64

func (c Cfg) GetInt64(key string) int64

func (Cfg) GetInt64F added in v0.0.1

func (c Cfg) GetInt64F(key string, fallback int64) int64

func (Cfg) GetIntF added in v0.0.1

func (c Cfg) GetIntF(key string, fallback int) int

func (Cfg) Init

func (c Cfg) Init() error

type ConfigurationInterface added in v0.0.11

type ConfigurationInterface interface {
	Init() error
	Get(key string) string
	GetBool(key string) bool
	GetInt(key string) int
	GetInt64(key string) int64

	GetF(key, fallback string) string
	GetBoolF(key string, fallback bool) bool
	GetIntF(key string, fallback int) int
	GetInt64F(key string, fallback int64) int64
}

Default interface to be used on others modules

func NewCfg

func NewCfg() ConfigurationInterface

Build and get a new Cfg object

Jump to

Keyboard shortcuts

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