env

package
v0.0.0-...-a7f85cb Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReadTimeoutEnv = "SP_READ_TIMEOUT_SECONDS"
	EndMarkerEnv   = "SP_END_MARKER"
	DebugEnv       = "SP_DEBUG"
	FormatterEnv   = "SP_FORMATTER"
)
View Source
const (
	ReadTimeoutDefault = 30 * time.Second
	EndMarkerDefault   = "<-- END -->"
	DebugDefault       = false
	FormatterDefault   = "json"
)
View Source
const FormatOverrideFile = "/tmp/format.txt"

This file used to override SP_FORMATTER env (in case the step want to override it, because it can't modify the actual env)

Variables

This section is empty.

Functions

func Debug

func Debug() bool

func EndMarker

func EndMarker() string

func Formatter

func Formatter() string

func FormatterIs

func FormatterIs(formatter SpFormatter) bool

func GetEnvWithDefault

func GetEnvWithDefault(env, defaultVal string) string

func Parse

func Parse(v interface{}) status.Status

func ParseJSONItemsArray

func ParseJSONItemsArray(v string) (interface{}, error)

func ParseKeyValueEnv

func ParseKeyValueEnv(v string) (interface{}, error)

func ReadTimeout

func ReadTimeout() time.Duration

func SetFormatter

func SetFormatter(format SpFormatter, force bool)

func ToTypeAwareKeyValue

func ToTypeAwareKeyValue(v map[string]string) map[string]interface{}

func Validate

func Validate(s interface{}) error

Types

type JSONItemsArray

type JSONItemsArray struct {
	Items []string
}

This type is useful in case of json input of items array You can find usage example in ssh-parallel command

type OneofValidator

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

func (OneofValidator) Validate

func (v OneofValidator) Validate(val interface{}) (bool, error)

type SpFormatter

type SpFormatter string
const (
	JSONFormat  SpFormatter = "json"
	RawFormat   SpFormatter = "raw"
	PrintFormat SpFormatter = "print"
)

type Validator

type Validator interface {
	Validate(interface{}) (bool, error)
}

Jump to

Keyboard shortcuts

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