diff options
Diffstat (limited to 'config.cpp')
-rw-r--r-- | config.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -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; |