|
@@ -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
|
}
|