summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'config.cpp')
-rw-r--r--config.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/config.cpp b/config.cpp
index 0d9c117..3750bcf 100644
--- a/config.cpp
+++ b/config.cpp
@@ -63,8 +63,19 @@ void Config::readConfigfile(std::string filename)
auto attrs = x.second.get_child("<xmlattr>");
path.requested = attrs.get<std::string>("requested");
for (const auto& param: x.second) { // get all sub-elements of <path>
- if (param.first.size() > 0 && param.first[0] != '<') // exclude meta-elements like <xmlattr>
- path.params[param.first.data()] = param.second.data();
+ if (param.first.size() > 0 && param.first[0] != '<') { // exclude meta-elements like <xmlattr>
+ if (param.first == "auth") {
+ try {
+ std::string login{param.second.get<std::string>("<xmlattr>.login")};
+ std::string password{param.second.get<std::string>("<xmlattr>.password")};
+ path.auth[login] = password;
+ } catch (const std::exception& ex) {
+ std::cerr << "Warning: Can't read auth data from config: " << ex.what() << std::endl;
+ }
+ } else {
+ path.params[param.first] = param.second.data();
+ }
+ }
}
site_struct.paths.push_back(path);
} else if (x.first == "certpath"s) {