config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config interface {
	Get(string) string
	GetOrDefault(string, string) string
}

func NewEnvFile

func NewEnvFile(configFolder string, logger logger) Config

func NewMockConfig

func NewMockConfig(configMap map[string]string) Config

type EnvLoader

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

func (*EnvLoader) Get

func (*EnvLoader) Get(key string) string

func (*EnvLoader) GetOrDefault

func (*EnvLoader) GetOrDefault(key, defaultValue string) string

type Snapshot added in v0.4.0

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

Snapshot is immutable. Values and Redacted return independent copies.

func LoadSnapshot added in v0.4.0

func LoadSnapshot(dir string, environment []string) (*Snapshot, error)

LoadSnapshot uses .env < .<APP_ENV>.env (or .local.env) < explicit environment. Missing conventional files are allowed; malformed files return errors. It never writes process environment. Callers choose whether to pass os.Environ().

func NewSnapshot added in v0.4.0

func NewSnapshot(values map[string]string) *Snapshot

func (*Snapshot) Get added in v0.4.0

func (s *Snapshot) Get(k string) string

func (*Snapshot) GetOrDefault added in v0.4.0

func (s *Snapshot) GetOrDefault(k, d string) string

func (*Snapshot) Redacted added in v0.4.0

func (s *Snapshot) Redacted() map[string]string

func (*Snapshot) Values added in v0.4.0

func (s *Snapshot) Values() map[string]string

Jump to

Keyboard shortcuts

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