env

package
v0.0.0-...-63c1a6e Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2021 License: Apache-2.0 Imports: 5 Imported by: 1

Documentation

Overview

Package env provides types to handle step environments in campaign specs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Environment

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

Environment represents an environment used for a campaign step, which may require values to be resolved from the outer environment the executor is running within.

func (Environment) Equal

func (e Environment) Equal(other Environment) bool

Equal verifies if two environments are equal.

func (Environment) IsStatic

func (e Environment) IsStatic() bool

IsStatic returns true if the environment doesn't depend on any outer environment variables.

Put another way: if this function returns true, then Resolve() will always return the same map for the environment.

func (Environment) MarshalJSON

func (e Environment) MarshalJSON() ([]byte, error)

MarshalJSON marshals the environment.

func (Environment) Resolve

func (e Environment) Resolve(outer []string) (map[string]string, error)

Resolve resolves the environment, using values from the given outer environment to fill in environment values as needed. If an environment variable doesn't exist in the outer environment, then an empty string will be used as the value.

outer must be an array of strings in the form `KEY=VALUE`. Generally speaking, this will be the return value from os.Environ().

func (*Environment) UnmarshalJSON

func (e *Environment) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals an environment from one of the two supported JSON forms: an array, or a string→string object.

func (*Environment) UnmarshalYAML

func (e *Environment) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals an environment from one of the two supported YAML forms: an array, or a string→string object.

Jump to

Keyboard shortcuts

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