mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 20:13:44 +02:00
Create netconf master if redis options are in local.conf.
This commit is contained in:
parent
0b84c10ccc
commit
c8c5d3b06e
2 changed files with 22 additions and 0 deletions
|
@ -30,6 +30,13 @@
|
||||||
|
|
||||||
#include "Constants.hpp"
|
#include "Constants.hpp"
|
||||||
|
|
||||||
|
#define ZT_LOCAL_CONFIG_NETCONF_REDIS_HOST "netconf.redisHost"
|
||||||
|
#define ZT_LOCAL_CONFIG_NETCONF_REDIS_PORT "netconf.redisPort"
|
||||||
|
#define ZT_LOCAL_CONFIG_NETCONF_REDIS_PORT_DEFAULT 6379
|
||||||
|
#define ZT_LOCAL_CONFIG_NETCONF_REDIS_AUTH "netconf.redisAuth"
|
||||||
|
#define ZT_LOCAL_CONFIG_NETCONF_REDIS_DBNUM "netconf.redisDatabaseNumber"
|
||||||
|
#define ZT_LOCAL_CONFIG_NETCONF_REDIS_DBNUM_DEFAULT 0
|
||||||
|
|
||||||
#ifdef ZT_ENABLE_NETCONF_MASTER
|
#ifdef ZT_ENABLE_NETCONF_MASTER
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
|
@ -310,6 +310,21 @@ Node::ReasonForTermination Node::run()
|
||||||
}
|
}
|
||||||
RR->node = this;
|
RR->node = this;
|
||||||
|
|
||||||
|
#ifdef ZT_ENABLE_NETCONF_MASTER
|
||||||
|
{
|
||||||
|
std::string redisHost(RR->nc->getLocalConfig(ZT_LOCAL_CONFIG_NETCONF_REDIS_HOST));
|
||||||
|
if (redisHost.length() > 0) {
|
||||||
|
unsigned int redisPort = Utils::strToUInt(RR->nc->getLocalConfig(ZT_LOCAL_CONFIG_NETCONF_REDIS_PORT).c_str());
|
||||||
|
if ((redisPort == 0)||(redisPort > 0xffff))
|
||||||
|
redisPort = ZT_LOCAL_CONFIG_NETCONF_REDIS_PORT_DEFAULT;
|
||||||
|
std::string redisAuth(RR->nc->getLocalConfig(ZT_LOCAL_CONFIG_NETCONF_REDIS_AUTH));
|
||||||
|
std::string redisDatabaseNumberStr(RR->nc->getLocalConfig(ZT_LOCAL_CONFIG_NETCONF_REDIS_DBNUM));
|
||||||
|
unsigned int redisDatabaseNumber = (redisDatabaseNumberStr.length() > 0) ? Utils::strToUInt(redisDatabaseNumberStr.c_str()) : (unsigned int)ZT_LOCAL_CONFIG_NETCONF_REDIS_DBNUM_DEFAULT;
|
||||||
|
RR->netconfMaster = new NetworkConfigMaster(RR,redisHost.c_str(),redisPort,redisAuth.c_str(),redisDatabaseNumber);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef ZT_AUTO_UPDATE
|
#ifdef ZT_AUTO_UPDATE
|
||||||
if (ZT_DEFAULTS.updateLatestNfoURL.length()) {
|
if (ZT_DEFAULTS.updateLatestNfoURL.length()) {
|
||||||
RR->updater = new SoftwareUpdater(RR);
|
RR->updater = new SoftwareUpdater(RR);
|
||||||
|
|
Loading…
Add table
Reference in a new issue