From 48908fb0bba69404dfd86d1af3b9ace1e0d598c9 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 15 May 2020 18:59:19 +0200 Subject: Speedup GetPath() --- config.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'config.h') diff --git a/config.h b/config.h index 46cd267..e60bba5 100644 --- a/config.h +++ b/config.h @@ -18,7 +18,7 @@ struct Path struct Site { - std::string name; + // std::string name; is the index in the m_sites map std::unordered_set hosts; std::vector paths; fs::path cert_path; @@ -36,7 +36,7 @@ struct Socket std::string address; std::string port; SocketProtocol protocol; - std::vector serve_sites; // if empty, automatically expand to all configured sites + std::unordered_set serve_sites; // if empty, automatically expand to all configured sites }; class Config @@ -44,12 +44,13 @@ class Config const std::string default_filename{"/etc/webserver.conf"}; void readConfigfile(std::string filename); + void validate(); std::string m_user; std::string m_group; int m_threads; std::vector m_plugin_directories; - std::vector m_sites; + std::unordered_map m_sites; std::vector m_sockets; public: @@ -62,7 +63,7 @@ class Config int Threads() const; const std::vector& PluginDirectories() const; - const std::vector& Sites() const; + const std::unordered_map& Sites() const; const std::vector& Sockets() const; // -- cgit v1.2.3