Init and optimizations
This commit is contained in:
22
racc_common/racc_common.go
Normal file
22
racc_common/racc_common.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package racc_common
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func GetENV(k, d string) string {
|
||||
if v := os.Getenv(k); v != "" {
|
||||
return v
|
||||
}
|
||||
return d
|
||||
}
|
||||
|
||||
func Enabled(k string, def bool) bool {
|
||||
b, err := strconv.ParseBool(strings.ToLower(os.Getenv(k)))
|
||||
if err != nil {
|
||||
return def
|
||||
}
|
||||
return b
|
||||
}
|
Reference in New Issue
Block a user