summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'config.cpp')
-rw-r--r--config.cpp21
1 files changed, 19 insertions, 2 deletions
diff --git a/config.cpp b/config.cpp
index 17376d0..c478265 100644
--- a/config.cpp
+++ b/config.cpp
@@ -40,7 +40,7 @@ void Config::readConfigfile(std::string filename)
if (x.first == "name"s) {
site_struct.name = x.second.data();
} else if (x.first == "host"s) {
- site_struct.host = x.second.data();
+ site_struct.hosts.insert(x.second.data());
} else if (x.first == "path"s) {
Path path;
auto attrs = x.second.get_child("<xmlattr>");
@@ -91,6 +91,15 @@ void Config::readConfigfile(std::string filename)
}
}
}
+
+ // expand socket sites
+ for (auto& socket: m_sockets) {
+ if (socket.serve_sites.empty()) {
+ for (const auto& site: m_sites) {
+ socket.serve_sites.push_back(site.name);
+ }
+ }
+ }
}
Config::Config(const std::string& filename)
@@ -143,7 +152,10 @@ void Config::dump() const
std::cout << std::endl;
for (const auto& site: m_sites) {
- std::cout << "Site: " << site.name << ": " << site.host << std::endl;
+ std::cout << "Site: " << site.name << ":";
+ for (const auto& host: site.hosts)
+ std::cout << " " << host;
+ std::cout << std::endl;
if (site.paths.size() == 0)
std::cout << " Warning: No paths configured." << std::endl;
for (const auto& path: site.paths) {
@@ -160,6 +172,11 @@ void Config::dump() const
std::cout << " Key: " << socket.key_path.generic_string() << std::endl;
std::cout << " Cert: " << socket.cert_path.generic_string() << std::endl;
}
+ std::cout << " Serving:";
+ for (const auto& site: socket.serve_sites) {
+ std::cout << " " << site;
+ }
+ std::cout << std::endl;
}
std::cout << "=============================================" << std::endl;
}