feat: add env DIFY_DEBUG
This commit is contained in:
1 parent
ba43598f64
commit
2e45163f93
4 files changed
+17
-2
No files matched your search
@@ -24,3 +24,15 @@ func GetEnvOrDefaultString(env string, defaultValue string) string {
|
||||
}
|
||||
return os.Getenv(env)
|
||||
}
|
||||
|
||||
func GetEnvOrDefaultBool(env string, defaultValue bool) bool {
|
||||
if env == "" || os.Getenv(env) == "" {
|
||||
return defaultValue
|
||||
}
|
||||
b, err := strconv.ParseBool(os.Getenv(env))
|
||||
if err != nil {
|
||||
SysError(fmt.Sprintf("failed to parse %s: %s, using default value: %t", env, err.Error(), defaultValue))
|
||||
return defaultValue
|
||||
}
|
||||
return b
|
||||
}
|
||||
Reference in new issue
Block a user