summaryrefslogtreecommitdiffhomepage
path: root/config.cpp
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-04-03 13:54:08 +0200
committerRoland Reichwein <mail@reichwein.it>2020-04-03 13:54:08 +0200
commitd8c3333e7a7330c10bb96e426482e2b158011251 (patch)
tree761dbe37aa3da1900826ffc8db6d89ecdea96927 /config.cpp
parente60bb89a6d1392c0007a1fbc03faf007faf76167 (diff)
Added configuration file (WIP)
Diffstat (limited to 'config.cpp')
-rw-r--r--config.cpp35
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;
+}