summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-04-05 14:22:31 +0200
committerRoland Reichwein <mail@reichwein.it>2020-04-05 14:22:31 +0200
commite234229ae80da0fa9967b797f7b5f4f381cba4b4 (patch)
tree02bed359b39eb1e8b7f022afb6fdba451292b5c6 /config.cpp
parent918685c1c09de1e3cd14c41bb8cc8b89a177ccd2 (diff)
All certificates configurable per site
Diffstat (limited to 'config.cpp')
-rw-r--r--config.cpp16
1 files changed, 8 insertions, 8 deletions
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;