envconfig

package
v1.2.7 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 7 Imported by: 11

Documentation

Overview

Package envconfig provides utilities for reading environment variables.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

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

Env holds context for loading config env vars.

func New

func New(opt Options) *Env

New creates a client for loading config from env vars.

func NewSimple added in v0.12.0

func NewSimple(sessionName string) *Env

NewSimple creates a client for loading config from env vars.

func (*Env) Bool

func (e *Env) Bool(name string, defaultValue bool) bool

Bool extracts boolean value from env var. It returns the provided defaultValue if the env var is empty. The value returned is also recorded in logs.

func (*Env) Duration

func (e *Env) Duration(name string, defaultValue time.Duration) time.Duration

Duration extracts time.Duration value from env var. It returns the provided defaultValue if the env var is empty. The value returned is also recorded in logs.

func (*Env) Float64Slice added in v1.1.0

func (e *Env) Float64Slice(name string, defaultValue []float64) []float64

Float64Slice extracts []float64 from env var. It returns the provided defaultValue if the env var is empty. The value returned is also recorded in logs.

func (*Env) Int

func (e *Env) Int(name string, defaultValue int) int

Int extracts int value from env var. It returns the provided defaultValue if the env var is empty. The value returned is also recorded in logs.

func (*Env) Int64 added in v1.2.1

func (e *Env) Int64(name string, defaultValue int64) int64

Int64 extracts int64 value from env var. It returns the provided defaultValue if the env var is empty. The value returned is also recorded in logs.

func (*Env) String

func (e *Env) String(name string, defaultValue string) string

String extracts string from env var. It returns the provided defaultValue if the env var is empty. The string returned is also recorded in logs.

func (*Env) Uint64 added in v0.11.0

func (e *Env) Uint64(name string, defaultValue uint64) uint64

Uint64 extracts uint64 value from env var. It returns the provided defaultValue if the env var is empty. The value returned is also recorded in logs.

type Options

type Options struct {
	DisableQueryStore bool
	Secret            *secret.Secret
	Printf            boilerplate.FuncPrintf
}

Options defines client options.

Jump to

Keyboard shortcuts

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