pkg: istio.io/pkg/env Index | Files

package env

import "istio.io/pkg/env"

Package env makes it possible to track use of environment variables within a procress in order to generate documentation for these uses.

Index

Package Files

var.go

func RegisterVar Uses

func RegisterVar(v Var)

RegisterVar registers a generic environment variable.

type BoolVar Uses

type BoolVar struct {
    Var
}

BoolVar represents a single boolean environment variable.

func RegisterBoolVar Uses

func RegisterBoolVar(name string, defaultValue bool, description string) BoolVar

RegisterBoolVar registers a new boolean environment variable.

func (BoolVar) Get Uses

func (v BoolVar) Get() bool

Get retrieves the value of the environment variable. It returns the value, which will be the default if the variable is not present. To distinguish between an empty value and an unset value, use Lookup.

func (BoolVar) Lookup Uses

func (v BoolVar) Lookup() (bool, bool)

Lookup retrieves the value of the environment variable. If the variable is present in the environment the value (which may be empty) is returned and the boolean is true. Otherwise the returned value will be the default and the boolean will be false.

type DurationVar Uses

type DurationVar struct {
    Var
}

DurationVar represents a single duration environment variable.

func RegisterDurationVar Uses

func RegisterDurationVar(name string, defaultValue time.Duration, description string) DurationVar

RegisterDurationVar registers a new duration environment variable.

func (DurationVar) Get Uses

func (v DurationVar) Get() time.Duration

Get retrieves the value of the environment variable. It returns the value, which will be the default if the variable is not present. To distinguish between an empty value and an unset value, use Lookup.

func (DurationVar) Lookup Uses

func (v DurationVar) Lookup() (time.Duration, bool)

Lookup retrieves the value of the environment variable. If the variable is present in the environment the value (which may be empty) is returned and the boolean is true. Otherwise the returned value will be the default and the boolean will be false.

type FloatVar Uses

type FloatVar struct {
    Var
}

FloatVar represents a single floating-point environment variable.

func RegisterFloatVar Uses

func RegisterFloatVar(name string, defaultValue float64, description string) FloatVar

RegisterFloatVar registers a new floating-point environment variable.

func (FloatVar) Get Uses

func (v FloatVar) Get() float64

Get retrieves the value of the environment variable. It returns the value, which will be the default if the variable is not present. To distinguish between an empty value and an unset value, use Lookup.

func (FloatVar) Lookup Uses

func (v FloatVar) Lookup() (float64, bool)

Lookup retrieves the value of the environment variable. If the variable is present in the environment the value (which may be empty) is returned and the boolean is true. Otherwise the returned value will be the default and the boolean will be false.

type IntVar Uses

type IntVar struct {
    Var
}

IntVar represents a single integer environment variable.

func RegisterIntVar Uses

func RegisterIntVar(name string, defaultValue int, description string) IntVar

RegisterIntVar registers a new integer environment variable.

func (IntVar) Get Uses

func (v IntVar) Get() int

Get retrieves the value of the environment variable. It returns the value, which will be the default if the variable is not present. To distinguish between an empty value and an unset value, use Lookup.

func (IntVar) Lookup Uses

func (v IntVar) Lookup() (int, bool)

Lookup retrieves the value of the environment variable. If the variable is present in the environment the value (which may be empty) is returned and the boolean is true. Otherwise the returned value will be the default and the boolean will be false.

type StringVar Uses

type StringVar struct {
    Var
}

StringVar represents a single string environment variable.

func RegisterStringVar Uses

func RegisterStringVar(name string, defaultValue string, description string) StringVar

RegisterStringVar registers a new string environment variable.

func (StringVar) Get Uses

func (v StringVar) Get() string

Get retrieves the value of the environment variable. It returns the value, which will be the default if the variable is not present. To distinguish between an empty value and an unset value, use Lookup.

func (StringVar) Lookup Uses

func (v StringVar) Lookup() (string, bool)

Lookup retrieves the value of the environment variable. If the variable is present in the environment the value (which may be empty) is returned and the boolean is true. Otherwise the returned value will be the default and the boolean will be false.

type Var Uses

type Var struct {
    // The name of the environment variable.
    Name string

    // The optional default value of the environment variable.
    DefaultValue string

    // Description of the environment variable's purpose.
    Description string

    // Hide the existence of this variable when outputting usage information.
    Hidden bool

    // Mark this variable as deprecated when generating usage information.
    Deprecated bool

    // The type of the variable's value
    Type VarType
}

Var describes a single environment variable

func VarDescriptions Uses

func VarDescriptions() []Var

VarDescriptions returns a description of this process' environment variables, sorted by name.

type VarType Uses

type VarType byte

The type of a variable's value

const (
    // Variable holds a free-form string.
    STRING VarType = iota
    // Variable holds a boolean value.
    BOOL
    // Variable holds a signed integer.
    INT
    // Variables holds a floating point value.
    FLOAT
    // Variable holds a time duration.
    DURATION
)

Package env imports 6 packages (graph) and is imported by 35 packages. Updated 2019-05-13. Refresh now. Tools for package owners.