aboutsummaryrefslogtreecommitdiff
path: root/weed/util/parse.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/util/parse.go')
-rw-r--r--weed/util/parse.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/weed/util/parse.go b/weed/util/parse.go
index 502f3a80f..180e8e61e 100644
--- a/weed/util/parse.go
+++ b/weed/util/parse.go
@@ -28,6 +28,18 @@ func ParseUint64(text string, defaultValue uint64) uint64 {
return count
}
+func ParseBool(s string, defaultValue bool) bool {
+ value, err := strconv.ParseBool(s)
+ if err != nil {
+ return defaultValue
+ }
+ return value
+}
+
+func BoolToString(b bool) string {
+ return strconv.FormatBool(b)
+}
+
func ParseFilerUrl(entryPath string) (filerServer string, filerPort int64, path string, err error) {
if !strings.HasPrefix(entryPath, "http://") && !strings.HasPrefix(entryPath, "https://") {
entryPath = "http://" + entryPath