blob: de7612d5d5612e10f2e6a360ecd21f59f9765147 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#include "download_config.h"
#include <yql/essentials/core/file_storage/proto/file_storage.pb.h>
#include <library/cpp/protobuf/util/pb_io.h>
#include <util/generic/yexception.h>
#include <util/stream/str.h>
#include <google/protobuf/message.h>
namespace NYql {
bool TDownloadConfigBase::FindAndParseConfig(const TFileStorageConfig& cfg, TStringBuf name, ::google::protobuf::Message* msg) {
if (auto it = cfg.GetDownloaderConfig().find(name); it != cfg.GetDownloaderConfig().end()) {
try {
TStringInput in(it->second);
ParseFromTextFormat(in, *msg, EParseFromTextFormatOption::AllowUnknownField);
return true;
} catch (const yexception& e) {
throw yexception() << "Bad config for \"" << name << "\" downloader" << e;
}
}
return false;
}
}
|