func ExpandValueEnv(value string) (realValue string) {
	realValue = value

	vLen := len(value)
	// 3 = ${}
	if vLen < 3 {
		return
	}
	// Need start with "${" and end with "}", then return.
	if value[0] != '$' || value[1] != '{' || value[vLen-1] != '}' {
		return
	}

	key := ""
	defalutV := ""
	// value start with "${"
	for i := 2; i < vLen; i++ {
		if value[i] == '|' && (i+1 < vLen && value[i+1] == '|') {
			key = value[2:i]
			defalutV = value[i+2 : vLen-1] // other string is default value.
			break
		} else if value[i] == '}' {
			key = value[2:i]
			break
		}
	}

	realValue = os.Getenv(key)
	if realValue == "" {
		realValue = defalutV
	}

	return
}
// ExpandValueEnv 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".
ExpandValueEnv 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.


// ExpandValueEnv 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 ExpandValueEnv(value string) (realValue string) {
	realValue = value
	vLen := len(value)
	if vLen < 3 {
		return
	}
	if value[0] != '$' || value[1] != '{' || value[vLen-1] != '}' {
		return
	}
	key := ""
	defalutV := ""
	for i := 2; i < vLen; i++ {
		if value[i] == '|' && (i+1 < vLen && value[i+1] == '|') {
			key = value[2:i]
			defalutV = value[i+2 : vLen-1] 
			break
		} else if value[i] == '}' {
			key = value[2:i]
			break
		}
	}
	realValue = os.Getenv(key)
	if realValue == "" {
		realValue = defalutV
	}
	return
}
func ExpandValueEnv ( value string ) ( realValue string ) { realValue = value vLen := len ( value ) if vLen < 3 { return } if value [ 0 ] != '$' || value [ 1 ] != '{' || value [ vLen - 1 ] != '}' { return } key := " " defalutV := " " for i := 2 ; i < vLen ; i ++ { if value [ i ] == '|' && ( i + 1 < vLen && value [ i + 1 ] == '|' ) { key = value [ 2 : i ] defalutV = value [ i + 2 : vLen - 1 ] break } else if value [ i ] == '}' { key = value [ 2 : i ] break } } realValue = os . Getenv ( key ) if realValue == " " { realValue = defalutV } return }
ExpandValueEnv returns value of convert with environment variable.
ExpandValueEnv returns value of convert with environment variable .
// 3 = ${} // Need start with "${" and end with "}", then return. // value start with "${" // other string is default value.