environ

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterProvider

func RegisterProvider(name string, fn ProviderFactory)

RegisterProvider adds the named Provider's factory function to the map of known Providers

Types

type Environ

type Environ struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Environ is a concurrency safe-ish map[string]string for holding environment variables

func NewEnviron

func NewEnviron() *Environ

NewEnviron returns a new blank Environ instance

func NewEnvironFromEnv

func NewEnvironFromEnv() *Environ

NewEnvironFromEnv returns a new Environ instance populated from os.Environ

func (*Environ) Delete

func (e *Environ) Delete(key string) (v string)

Delete takes a key and removes it from this Environ, returning the value

func (*Environ) Len

func (e *Environ) Len() (l int)

Len returns the length of this Environ

func (*Environ) Load

func (e *Environ) Load(k string) (v string, ok bool)

Load takes a key and returns the value if it exists or false

func (*Environ) Merge

func (e *Environ) Merge(m map[string]string)

Merge takes a map[string]string and adds it to this Environ, overwriting any conflicting keys.

func (*Environ) SafeMerge

func (e *Environ) SafeMerge(m map[string]string)

SafeMerge takes a map[string]string and adds it to this Environ without overwriting keys

func (*Environ) Set

func (e *Environ) Set(k, v string)

Set takes a key / value pair and adds it to this Environ

func (*Environ) Slice

func (e *Environ) Slice() []string

Slice returns a sorted []string of key / value pairs from this Environ instance suitable for use in palce of os.Environ()

func (*Environ) String

func (e *Environ) String() string

String returns a stringified representation of this Environ

type Provider

type Provider interface {
	AddToEnviron(*Environ) error
}

Provider is a secrets provider able to inject variables into the environment

func GetProvider

func GetProvider(name string) (Provider, error)

GetProvider returns a new instance of the named Provider or an unregistered provider error

type ProviderFactory

type ProviderFactory func() (Provider, error)

ProviderFactory is a func that returns a new Provider

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

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