Documentation
¶
Index ¶
- func GetEnvBool(key string, defaultVal bool) bool
- func GetEnvDuration(key string, defaultVal time.Duration) time.Duration
- func GetEnvFloat(key string, defaultVal float64) float64
- func GetEnvInt(key string, defaultVal int) int
- func GetEnvString(key, defaultVal string) string
- type DefaultEnvironmentProvider
- type Environment
- func (e *Environment) GetBool(key string, defaultVal bool) bool
- func (e *Environment) GetDuration(key string, defaultVal time.Duration) time.Duration
- func (e *Environment) GetFloat(key string, defaultVal float64) float64
- func (e *Environment) GetInt(key string, defaultVal int) int
- func (e *Environment) GetString(key, defaultVal string) string
- type EnvironmentConfig
- type EnvironmentOption
- type EnvironmentProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetEnvBool ¶
func GetEnvFloat ¶
func GetEnvString ¶
Types ¶
type DefaultEnvironmentProvider ¶ added in v0.0.3
type DefaultEnvironmentProvider struct{}
DefaultEnvironmentProvider implements EnvironmentProvider using os.LookupEnv
func (*DefaultEnvironmentProvider) Get ¶ added in v0.0.3
func (p *DefaultEnvironmentProvider) Get(key string) string
Get returns the environment variable value or empty string if not found
type Environment ¶ added in v0.0.3
type Environment struct {
// contains filtered or unexported fields
}
Environment handles environment variable access with configuration
func NewEnvironment ¶ added in v0.0.3
func NewEnvironment(options ...EnvironmentOption) *Environment
NewEnvironment creates a new Environment instance with options
func (*Environment) GetBool ¶ added in v0.0.3
func (e *Environment) GetBool(key string, defaultVal bool) bool
GetBool gets a boolean environment variable
func (*Environment) GetDuration ¶ added in v0.0.3
GetDuration gets a duration environment variable
func (*Environment) GetFloat ¶ added in v0.0.3
func (e *Environment) GetFloat(key string, defaultVal float64) float64
GetFloat gets a float environment variable
func (*Environment) GetInt ¶ added in v0.0.3
func (e *Environment) GetInt(key string, defaultVal int) int
GetInt gets an integer environment variable
func (*Environment) GetString ¶ added in v0.0.3
func (e *Environment) GetString(key, defaultVal string) string
GetString gets a string environment variable
type EnvironmentConfig ¶ added in v0.0.3
type EnvironmentConfig struct {
Provider EnvironmentProvider
TrimSpaces bool
CaseSensitive bool
}
EnvironmentConfig holds configuration for environment variable handling
func DefaultEnvironmentConfig ¶ added in v0.0.3
func DefaultEnvironmentConfig() *EnvironmentConfig
DefaultEnvironmentConfig provides sensible defaults
func NewEnvironmentConfig ¶ added in v0.0.3
func NewEnvironmentConfig(options ...EnvironmentOption) *EnvironmentConfig
NewEnvironmentConfig creates a new environment config with options
type EnvironmentOption ¶ added in v0.0.3
type EnvironmentOption func(*EnvironmentConfig)
EnvironmentOption is a functional option for environment configuration
func WithCaseSensitive ¶ added in v0.0.3
func WithCaseSensitive(sensitive bool) EnvironmentOption
WithCaseSensitive enables/disables case sensitivity
func WithProvider ¶ added in v0.0.3
func WithProvider(provider EnvironmentProvider) EnvironmentOption
WithProvider sets a custom environment provider
func WithTrimSpaces ¶ added in v0.0.3
func WithTrimSpaces(trim bool) EnvironmentOption
WithTrimSpaces enables/disables trimming of whitespace