From e234229ae80da0fa9967b797f7b5f4f381cba4b4 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 5 Apr 2020 14:22:31 +0200 Subject: All certificates configurable per site --- config.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'config.cpp') diff --git a/config.cpp b/config.cpp index 6050768..072b1bd 100644 --- a/config.cpp +++ b/config.cpp @@ -58,6 +58,10 @@ void Config::readConfigfile(std::string filename) path.params[param.first.data()] = param.second.data(); } site_struct.paths.push_back(path); + } else if (x.first == "certpath"s) { + site_struct.cert_path = x.second.data(); + } else if (x.first == "keypath"s) { + site_struct.key_path = x.second.data(); } else throw std::runtime_error("Unknown element: "s + x.first); } @@ -80,10 +84,6 @@ void Config::readConfigfile(std::string filename) socket_struct.protocol = SocketProtocol::HTTPS; else throw std::runtime_error("Unknown protocol: "s + x.second.data()); - } else if (x.first == "certpath"s) { - socket_struct.cert_path = x.second.data(); - } else if (x.first == "keypath"s) { - socket_struct.key_path = x.second.data(); } else throw std::runtime_error("Unknown element: "s + x.first); } @@ -165,14 +165,14 @@ void Config::dump() const std::cout << " " << param.first << ": " << param.second << std::endl; } } + if (site.key_path != ""s) { + std::cout << " Key: " << site.key_path.generic_string() << std::endl; + std::cout << " Cert: " << site.cert_path.generic_string() << std::endl; + } } for (const auto& socket: m_sockets) { std::cout << "Socket: " << socket.address << ":" << socket.port << " (" << (socket.protocol == SocketProtocol::HTTP ? "HTTP" : "HTTPS") << ")" << std::endl; - if (socket.protocol == SocketProtocol::HTTPS) { - 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; -- cgit v1.2.3