From d8c3333e7a7330c10bb96e426482e2b158011251 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Fri, 3 Apr 2020 13:54:08 +0200 Subject: Added configuration file (WIP) --- config.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 config.cpp (limited to 'config.cpp') 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 +#include + +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("webserver.user"); + m_group = tree.get("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; +} -- cgit v1.2.3