diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-04-04 19:24:16 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-04-04 19:24:16 +0200 |
commit | 1fcaed7a34cce8e55bb071d503bb583f715e7d37 (patch) | |
tree | 9c6bcaa267a66b902f308ee253a79da874780e55 /config.cpp | |
parent | 938fbe7a2f2f10a3abb530a9463e57fc20f40038 (diff) |
Serve configured sockets
Diffstat (limited to 'config.cpp')
-rw-r--r-- | config.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -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; } |