@cryptotaxi247 / kubo / commits / a99448f0d

Error out on unknown levelds compression rather than assuming the default

License: MIT Signed-off-by: Kevin Atkinson <k@kevina.org>

Kevin Atkinson committed Jul 14, 2017 at 14:58 UTC a99448f0de958e73e11b26f33400d69cea618391
1 file changed +3 -3
repo/fsrepo/datastores.go
+3 -3
@@ -200,15 +200,15 @@ func LeveldsDatastoreConfig(params map[string]interface{}) (DatastoreConfig, err
200 return nil, fmt.Errorf("'path' field is missing or not string")
201 }
202
203 - switch params["compression"].(string) {
203 + switch cm := params["compression"].(string); cm {
204 case "none":
205 c.compression = ldbopts.NoCompression
206 case "snappy":
207 c.compression = ldbopts.SnappyCompression
208 case "":
209 - fallthrough
210 - default:
209 c.compression = ldbopts.DefaultCompression
210 + default:
211 + return nil, fmt.Errorf("unrecognized value for compression: %s", cm)
212 }
213
214 return &c, nil