diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-04-03 13:54:08 +0200 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-04-03 13:54:08 +0200 |
commit | d8c3333e7a7330c10bb96e426482e2b158011251 (patch) | |
tree | 761dbe37aa3da1900826ffc8db6d89ecdea96927 /config.cpp | |
parent | e60bb89a6d1392c0007a1fbc03faf007faf76167 (diff) |
Added configuration file (WIP)
Diffstat (limited to 'config.cpp')
-rw-r--r-- | config.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/config.cpp b/config.cpp new file mode 100644 index 0000000..edbe3c4 --- /dev/null +++ b/config.cpp @@ -0,0 +1,35 @@ +#include "config.h" + +#include <boost/property_tree/ptree.hpp> +#include <boost/property_tree/xml_parser.hpp> + +namespace pt = boost::property_tree; + +void Config::readConfigfile(std::string filename) +{ + if (filename == "") { + filename = default_filename; + } + + pt::ptree tree; + + pt::read_xml(filename, tree); + + m_user = tree.get<std::string>("webserver.user"); + m_group = tree.get<std::string>("webserver.group1"); +} + +Config::Config(const std::string& filename) +{ + readConfigfile(filename); +} + +std::string Config::User() const +{ + return m_user; +} + +std::string Config::Group() const +{ + return m_group; +} |