mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 04:00:50 +00:00
optimization code
This commit is contained in:
parent
484ca3a643
commit
1222c87be3
@ -119,9 +119,8 @@ func Getenv(env interface{}) (string, bool) {
|
|||||||
|
|
||||||
// Onley support string key.
|
// Onley support string key.
|
||||||
if key, ok := env.(string); ok {
|
if key, ok := env.(string); ok {
|
||||||
if len(key) > len(envKeySign) && strings.HasPrefix(key, envKeySign) {
|
if envKey := strings.TrimPrefix(key, envKeySign); envKey != key {
|
||||||
key = strings.TrimLeft(key, envKeySign)
|
return os.Getenv(envKey), true
|
||||||
return os.Getenv(key), true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "", false
|
return "", false
|
||||||
|
Loading…
Reference in New Issue
Block a user