Browse Source

hide json in pdns slave config

develop
Robin Thoni 8 years ago
parent
commit
364daaa736
2 changed files with 17 additions and 12 deletions
  1. 12
    11
      src/DataAccess/PdnsSlaveConfig.cpp
  2. 5
    1
      src/DataAccess/PdnsSlaveConfig.h

+ 12
- 11
src/DataAccess/PdnsSlaveConfig.cpp View File

@@ -4,6 +4,7 @@
4 4
 
5 5
 #include <fstream>
6 6
 #include <iostream>
7
+# include <json/json.h>
7 8
 #include "PdnsSlaveConfig.h"
8 9
 
9 10
 PdnsSlaveConfig::PdnsSlaveConfig(const std::string &filePath)
@@ -16,27 +17,27 @@ bool PdnsSlaveConfig::readConfig()
16 17
     std::ifstream file(_filePath);
17 18
     if (!file)
18 19
         return false;
20
+    Json::Value root;
19 21
     try
20 22
     {
21
-        Json::Value root;
22 23
         file >> root;
23 24
         file.close();
24
-        if (!readString(root, "dhcpd-file", _dhcpdFilePath))
25
-            return false;
26
-        if (!readString(root, "dhcpd-template", _dhcpdTemplatePath))
27
-            return false;
28
-        if (!readString(root, "hosts-file", _hostsPath))
29
-            return false;
30
-        if (!readSqlConfiguration(root, "master", _masterConfig))
31
-            return false;
32
-        if (!readSqlConfiguration(root, "slave", _slaveConfig))
33
-            return false;
34 25
     }
35 26
     catch (...)
36 27
     {
37 28
         file.close();
38 29
         return false;
39 30
     }
31
+    if (!readString(root, "dhcpd-file", _dhcpdFilePath))
32
+        return false;
33
+    if (!readString(root, "dhcpd-template", _dhcpdTemplatePath))
34
+        return false;
35
+    if (!readString(root, "hosts-file", _hostsPath))
36
+        return false;
37
+    if (!readSqlConfiguration(root, "master", _masterConfig))
38
+        return false;
39
+    if (!readSqlConfiguration(root, "slave", _slaveConfig))
40
+        return false;
40 41
 
41 42
     return true;
42 43
 }

+ 5
- 1
src/DataAccess/PdnsSlaveConfig.h View File

@@ -6,9 +6,13 @@
6 6
 #define PDNS_SLAVE_PDNSSLAVECONFIG_H
7 7
 
8 8
 # include <string>
9
-# include <json/json.h>
10 9
 # include "DBO/SqlConfiguration.h"
11 10
 
11
+namespace Json
12
+{
13
+    class Value;
14
+}
15
+
12 16
 class PdnsSlaveConfig
13 17
 {
14 18
 public:

Loading…
Cancel
Save