main: use fallback parameter when converting a YAML node

as yaml-cpp returns an invalid node when the node to be indexed
does not exist all. but it allows us to provide a fallback value
which is returned when the node is not valid. so, let's just use
this helper for accessing a node which does not necessarily exist.

simpler this way

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#15488
This commit is contained in:
Kefu Chai
2023-09-20 18:14:04 +08:00
committed by Pavel Emelyanov
parent f239849563
commit 6fc171b9cf

View File

@@ -164,7 +164,7 @@ struct convert<::object_storage_endpoint_param> {
static bool decode(const Node& node, ::object_storage_endpoint_param& ep) {
ep.endpoint = node["name"].as<std::string>();
ep.config.port = node["port"].as<unsigned>();
ep.config.use_https = node["https"] && node["https"].as<bool>();
ep.config.use_https = node["https"].as<bool>(false);
if (node["aws_region"]) {
ep.config.aws.emplace();
ep.config.aws->region = node["aws_region"].as<std::string>();