envvar

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() ports.EnvVar

New creates a new envvar adapter that satisfies ports.EnvVar.

Types

type Adapter

type Adapter struct{}

Adapter provides environment variable access using the envvar library.

func (*Adapter) Bind

func (a *Adapter) Bind(dst any) error

Bind populates a struct from environment variables. This is a simplified implementation that doesn't use struct tags.

func (*Adapter) BindWithPrefix

func (a *Adapter) BindWithPrefix(dst any, prefix string) error

BindWithPrefix binds with a prefix.

func (*Adapter) DumpRedacted

func (a *Adapter) DumpRedacted() map[string]string

DumpRedacted returns environment with secrets redacted.

func (*Adapter) Get

func (a *Adapter) Get(key string) (string, bool)

Get returns the raw value and presence indicator.

func (*Adapter) GetBoolOr

func (a *Adapter) GetBoolOr(key string, def bool) bool

GetBoolOr returns the value as boolean or default if not present.

func (*Adapter) GetDurationOr

func (a *Adapter) GetDurationOr(key string, def time.Duration) time.Duration

GetDurationOr returns the value as duration or default if not present.

func (*Adapter) GetFloat64Or

func (a *Adapter) GetFloat64Or(key string, def float64) float64

GetFloat64Or returns the value as float64 or default if not present.

func (*Adapter) GetInt64Or

func (a *Adapter) GetInt64Or(key string, def int64) int64

GetInt64Or returns the value as int64 or default if not present.

func (*Adapter) GetIntOr

func (a *Adapter) GetIntOr(key string, def int) int

GetIntOr returns the value as integer or default if not present.

func (*Adapter) GetOr

func (a *Adapter) GetOr(key, def string) string

GetOr returns the value or default if not present.

func (*Adapter) GetUint64Or

func (a *Adapter) GetUint64Or(key string, def uint64) uint64

GetUint64Or returns the value as uint64 or default if not present.

func (*Adapter) GetUintOr

func (a *Adapter) GetUintOr(key string, def uint) uint

GetUintOr returns the value as uint or default if not present.

func (*Adapter) LoadEnvFiles

func (a *Adapter) LoadEnvFiles(paths []string) error

LoadEnvFiles loads environment variables from files. Tries .env then /env/.env by default.

func (*Adapter) MustBind

func (a *Adapter) MustBind(dst any)

MustBind panics on binding errors.

func (*Adapter) MustBindWithPrefix

func (a *Adapter) MustBindWithPrefix(dst any, prefix string)

MustBindWithPrefix panics on binding errors with prefix.

func (*Adapter) MustGet

func (a *Adapter) MustGet(key string) string

MustGet returns the value or panics if not present.

func (*Adapter) MustGetBool

func (a *Adapter) MustGetBool(key string) bool

MustGetBool returns the value as boolean or panics if not present.

func (*Adapter) MustGetDuration

func (a *Adapter) MustGetDuration(key string) time.Duration

MustGetDuration returns the value as duration or panics if not present.

func (*Adapter) MustGetFloat64

func (a *Adapter) MustGetFloat64(key string) float64

MustGetFloat64 returns the value as float64 or panics if not present.

func (*Adapter) MustGetInt

func (a *Adapter) MustGetInt(key string) int

MustGetInt returns the value as integer or panics if not present.

func (*Adapter) MustGetInt64

func (a *Adapter) MustGetInt64(key string) int64

MustGetInt64 returns the value as int64 or panics if not present.

func (*Adapter) MustGetUint

func (a *Adapter) MustGetUint(key string) uint

MustGetUint returns the value as uint or panics if not present.

func (*Adapter) MustGetUint64

func (a *Adapter) MustGetUint64(key string) uint64

MustGetUint64 returns the value as uint64 or panics if not present.

Jump to

Keyboard shortcuts

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