-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigcore.cpp
More file actions
58 lines (51 loc) · 1.66 KB
/
configcore.cpp
File metadata and controls
58 lines (51 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "configcore.h"
// PUT
#include <put/cxxutils/syslogstream.h>
#include <put/specialized/mountpoints.h>
#ifndef CONFIG_USERNAME
#define CONFIG_USERNAME "config"
#endif
#ifndef CONFIG_IO_SOCKET
#define CONFIG_IO_SOCKET "io"
#endif
#ifndef CONFIG_DIRECTOR_SOCKET
#define CONFIG_DIRECTOR_SOCKET "director"
#endif
ConfigCore::ConfigCore(void)
{
if(scfs_path == nullptr)
reinitialize_paths();
if(scfs_path == nullptr)
{
posix::syslog << posix::priority::error
<< "SCFS is not mounted! Unable to bind Config and Config Director sockets."
<< posix::eom;
}
else
{
std::string base = scfs_path;
base.push_back('/');
base.append(CONFIG_USERNAME);
base.push_back('/');
if(m_config_server.bind((base + CONFIG_IO_SOCKET).c_str()))
posix::syslog << posix::priority::info
<< "Config provider bound to socket file %1"
<< base + CONFIG_IO_SOCKET
<< posix::eom;
else
posix::syslog << posix::priority::error
<< "Unable to bind Config provider to %1"
<< base + CONFIG_IO_SOCKET
<< posix::eom;
if(m_director_server.bind((base + CONFIG_DIRECTOR_SOCKET).c_str()))
posix::syslog << posix::priority::info
<< "Config Director provider bound to %1"
<< base + CONFIG_DIRECTOR_SOCKET
<< posix::eom;
else
posix::syslog << posix::priority::error
<< "Unable to bind Config Director provider to %1"
<< base + CONFIG_DIRECTOR_SOCKET
<< posix::eom;
}
}