diff options
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; +} |