-
Notifications
You must be signed in to change notification settings - Fork 543
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(http1): add option to disable request context pool
test: add ut refactor: use env instead of option optimize: method to get & put
- Loading branch information
1 parent
a64f390
commit b43cd0c
Showing
4 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package utils | ||
|
||
import ( | ||
"os" | ||
"strconv" | ||
"strings" | ||
|
||
"github.com/cloudwego/hertz/pkg/common/errors" | ||
) | ||
|
||
// Get bool from env | ||
func GetBoolFromEnv(key string) (bool, error) { | ||
value, isExist := os.LookupEnv(key) | ||
if !isExist { | ||
return false, errors.NewPublic("env not exist") | ||
} | ||
|
||
value = strings.TrimSpace(value) | ||
return strconv.ParseBool(value) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters