xenv

package module
v0.0.0-...-e3b5499 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2021 License: MIT Imports: 6 Imported by: 0

README

xenv

env

Documentation

Index

Constants

View Source
const DefaultSecret = "zpCjWPsbqK@@^hR01qLDmZcXhKRIZgjHfxSG2KA%J#bFp!7YQVSmzXGc!sE!^qSM7@&d%oXHQtpR7K*8eRTdhRKjaxF#t@bd#A!"

Variables

View Source
var Prefix = ""

Functions

func Clear

func Clear()

func Expand

func Expand(data string) string

Expand replaces ${var} or $var in the string according to the values of the current environment variables. References to undefined variables are replaced by the empty string.

func ExpandEnv

func ExpandEnv(value string) string

ExpandEnv returns value of convert with environment variable. Return environment variable if value start with "${" and end with "}". Return default value if environment variable is empty or not exist.

It accept value formats "${env}" , "${env||}}" , "${env||defaultValue}" , "defaultvalue". Examples:

v1 := config.ExpandValueEnv("${GOPATH}")			// return the GOPATH environment variable.
v2 := config.ExpandValueEnv("${GOAsta||/usr/local/go}")	// return the default value "/usr/local/go/".
v3 := config.ExpandValueEnv("Astaxie")				// return the value "Astaxie".

func Get

func Get(val *string, names ...string)

func GetEnv

func GetEnv(names ...string) string

func GetSys

func GetSys(val *string, names ...string)

func GetSysEnv

func GetSysEnv(names ...string) string

func Lookup

func Lookup(key string) (string, bool)

func Set

func Set(key, value string) error

func SetSys

func SetSys(key, value string) error

func TrimPrefix

func TrimPrefix(key string) string

func Unsetenv

func Unsetenv(key string) error

func WithPrefix

func WithPrefix(key string) string

Types

type Env

type Env string

func (Env) Bool

func (env Env) Bool() bool

func (Env) Enable

func (env Env) Enable()

func (Env) Float

func (env Env) Float() float64

func (Env) Get

func (env Env) Get() string

func (Env) Int

func (env Env) Int() int64

func (Env) New

func (env Env) New(name string) Env

func (Env) Set

func (env Env) Set(dt string)

func (Env) Unset

func (env Env) Unset()

Jump to

Keyboard shortcuts

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