mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Correctly parse extra config textpbs as textpbs, not binarypbs.
This commit is contained in:
17
lib/flags.cc
17
lib/flags.cc
@@ -183,9 +183,13 @@ void FlagGroup::parseFlagsWithConfigFiles(int argc, const char* argv[],
|
|||||||
parseFlags(argc, argv,
|
parseFlags(argc, argv,
|
||||||
[&](const auto& filename) {
|
[&](const auto& filename) {
|
||||||
const auto& it = configFiles.find(filename);
|
const auto& it = configFiles.find(filename);
|
||||||
std::string data;
|
|
||||||
if (it != configFiles.end())
|
if (it != configFiles.end())
|
||||||
data = it->second;
|
{
|
||||||
|
ConfigProto newConfig;
|
||||||
|
if (!newConfig.ParseFromString(it->second))
|
||||||
|
Error() << "couldn't load built-in config proto";
|
||||||
|
config.MergeFrom(newConfig);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::ifstream f(filename, std::ios::out);
|
std::ifstream f(filename, std::ios::out);
|
||||||
@@ -194,13 +198,10 @@ void FlagGroup::parseFlagsWithConfigFiles(int argc, const char* argv[],
|
|||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << f.rdbuf();
|
ss << f.rdbuf();
|
||||||
data = ss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
ConfigProto newConfig;
|
if (!google::protobuf::TextFormat::MergeFromString(ss.str(), &config))
|
||||||
if (!newConfig.ParseFromString(data))
|
Error() << "couldn't load external config proto";
|
||||||
Error() << "couldn't load config proto";
|
}
|
||||||
config.MergeFrom(newConfig);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user