Fix true/false parsing in json configs like no_recovery/no_rebalance

This commit is contained in:
Vitaliy Filippov
2022-06-04 13:27:06 +03:00
parent 3e1b03bb5c
commit 0cdc9292c8
4 changed files with 28 additions and 10 deletions
+1 -4
View File
@@ -92,10 +92,7 @@ void nfs_proxy_t::run(json11::Json cfg)
if (bind_address == "")
bind_address = "0.0.0.0";
default_pool = cfg["pool"].as_string();
portmap_enabled = cfg.object_items().find("portmap") == cfg.object_items().end() ||
cfg["portmap"].uint64_value() ||
cfg["portmap"].string_value() == "yes" ||
cfg["portmap"].string_value() == "true";
portmap_enabled = !json_is_false(cfg["portmap"]);
nfs_port = cfg["port"].uint64_value() & 0xffff;
if (!nfs_port)
nfs_port = 2049;