fix: allow the levelds compression level to be unspecified
Otherwise, the user will get a confusing panic. And given that we support "", we might as well support nil.
Steven Allen committed
Aug 23, 2021 at 18:24 UTC
852684914a973a682a52ae37f3f9fa8fd85b8a16
1 file changed
+2
-2
plugin/plugins/levelds/levelds.go
+2
-2
@@ -54,12 +54,12 @@ func (*leveldsPlugin) DatastoreConfigParser() fsrepo.ConfigFromMap {
54
return nil, fmt.Errorf("'path' field is missing or not string")
55
}
56
57
- switch cm := params["compression"].(string); cm {
57
+ switch cm := params["compression"]; cm {
58
case "none":
59
c.compression = ldbopts.NoCompression
60
case "snappy":
61
c.compression = ldbopts.SnappyCompression
62
- case "":
62
+ case "", nil:
63
c.compression = ldbopts.DefaultCompression
64
default:
65
return nil, fmt.Errorf("unrecognized value for compression: %s", cm)