diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-05-15 18:59:19 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-05-15 18:59:19 +0200 |
commit | 48908fb0bba69404dfd86d1af3b9ace1e0d598c9 (patch) | |
tree | e8b60f5dcb692d1840e9c948b92689c1c3c0c284 /config.h | |
parent | 2a3c27aadee91cd7b179e762ef0fe99128345bd1 (diff) |
Speedup GetPath()
Diffstat (limited to 'config.h')
-rw-r--r-- | config.h | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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<std::string> hosts; std::vector<Path> paths; fs::path cert_path; @@ -36,7 +36,7 @@ struct Socket std::string address; std::string port; SocketProtocol protocol; - std::vector<std::string> serve_sites; // if empty, automatically expand to all configured sites + std::unordered_set<std::string> 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<std::string> m_plugin_directories; - std::vector<Site> m_sites; + std::unordered_map<std::string, Site> m_sites; std::vector<Socket> m_sockets; public: @@ -62,7 +63,7 @@ class Config int Threads() const; const std::vector<std::string>& PluginDirectories() const; - const std::vector<Site>& Sites() const; + const std::unordered_map<std::string, Site>& Sites() const; const std::vector<Socket>& Sockets() const; // |