summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-04-04 19:24:16 +0200
committerRoland Reichwein <mail@reichwein.it>2020-04-04 19:24:16 +0200
commit1fcaed7a34cce8e55bb071d503bb583f715e7d37 (patch)
tree9c6bcaa267a66b902f308ee253a79da874780e55 /config.cpp
parent938fbe7a2f2f10a3abb530a9463e57fc20f40038 (diff)
Serve configured sockets
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;
}