env

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfig

func NewConfig[T any](opts ...Options) (T, error)

NewConfig gets configuration from environment variable

func Parse

func Parse(v interface{}, opts ...Options) error

Types

type Options

type Options struct {
	// Environment keys and values that will be accessible for the service
	Environment map[string]string

	// TagName specifies another tagname to use rather than the default env
	TagName string

	// RequiredIfNoDef automatically sets all env as required if they do not declare 'envDefault'
	RequiredIfNoDef bool

	// OnSet allows to run a function when a value is set
	OnSet env.OnSetFn

	// Prefix define a prefix for each key
	Prefix string

	// AltPrefix define a alternate prefix for each key
	AltPrefix string
}

Jump to

Keyboard shortcuts

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