envars

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeEnvSlices

func MergeEnvSlices(base []string, over ...string) (merged []string)

MergeEnvSlices merges two slices into single, sorted, deduplicated slice by applying `over` slice into `base`. The `over` slice will be used if the key overlaps. See https://golang.org/pkg/os/exec/#Cmd `Env` field to read more about slice format.

Types

type EnvSlice

type EnvSlice []string

func EvalVariables

func EvalVariables(ctx context.Context, r io.Reader, envSlice ...string) (ret EnvSlice, _ error)

EvalVariables evaluates dot env file in similar way `bash source` would do and returns all environment variables available at end of the execution of the script. Currently it supports any bash script and can cause side effects. TODO(bwplotka): Walk over syntex and allow list few syntax elements only?

func (EnvSlice) Lookup

func (e EnvSlice) Lookup(k string) (string, bool)

func (*EnvSlice) Set

func (e *EnvSlice) Set(kvs ...string)

Jump to

Keyboard shortcuts

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