添加node配置文件读取
This commit is contained in:
parent
2d98a0c6b4
commit
fd8708e197
@ -115,7 +115,11 @@ bool App::Init(int argc, char* argv[])
|
|||||||
a8::Timer::Instance()->Init();
|
a8::Timer::Instance()->Init();
|
||||||
JsonDataMgr::Instance()->Init();
|
JsonDataMgr::Instance()->Init();
|
||||||
GCListener::Instance()->Init();
|
GCListener::Instance()->Init();
|
||||||
|
#if MASTER_MODE
|
||||||
|
uuid.SetMachineId((node_id - 1) * MAX_NODE_ID + instance_id);
|
||||||
|
#else
|
||||||
uuid.SetMachineId(instance_id);
|
uuid.SetMachineId(instance_id);
|
||||||
|
#endif
|
||||||
GameClientMgr::Instance()->Init();
|
GameClientMgr::Instance()->Init();
|
||||||
MasterSvrMgr::Instance()->Init();
|
MasterSvrMgr::Instance()->Init();
|
||||||
TargetConnMgr::Instance()->Init();
|
TargetConnMgr::Instance()->Init();
|
||||||
|
@ -9,16 +9,55 @@ void JsonDataMgr::Init()
|
|||||||
std::string masterserver_cluster_json_file;
|
std::string masterserver_cluster_json_file;
|
||||||
std::string targetserver_cluster_json_file;
|
std::string targetserver_cluster_json_file;
|
||||||
if (f8::IsOnlineEnv()) {
|
if (f8::IsOnlineEnv()) {
|
||||||
|
#if MASTER_MODE
|
||||||
|
wsproxyserver_cluster_json_file = a8::Format("../config/node%d/game%d.wsproxy.cluster.json",
|
||||||
|
{
|
||||||
|
App::Instance()->node_id,
|
||||||
|
GAME_ID
|
||||||
|
});
|
||||||
|
masterserver_cluster_json_file = a8::Format("../config/node%d/game%d.masterserver.cluster.json",
|
||||||
|
{
|
||||||
|
App::Instance()->node_id,
|
||||||
|
GAME_ID
|
||||||
|
});
|
||||||
|
targetserver_cluster_json_file = a8::Format("../config/node%d/game%d.gameserver.cluster.json",
|
||||||
|
{
|
||||||
|
App::Instance()->node_id,
|
||||||
|
GAME_ID
|
||||||
|
});
|
||||||
|
#else
|
||||||
wsproxyserver_cluster_json_file = a8::Format("../config/game%d.wsproxy.cluster.json", {GAME_ID});
|
wsproxyserver_cluster_json_file = a8::Format("../config/game%d.wsproxy.cluster.json", {GAME_ID});
|
||||||
masterserver_cluster_json_file = a8::Format("../config/game%d.masterserver.cluster.json", {GAME_ID});
|
masterserver_cluster_json_file = a8::Format("../config/game%d.masterserver.cluster.json", {GAME_ID});
|
||||||
targetserver_cluster_json_file = a8::Format("../config/game%d.gameserver.cluster.json", {GAME_ID});
|
targetserver_cluster_json_file = a8::Format("../config/game%d.gameserver.cluster.json", {GAME_ID});
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef MASTER_MODE
|
||||||
|
wsproxyserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/node%d/game%d.wsproxy.cluster.json",
|
||||||
|
{
|
||||||
|
GAME_ID,
|
||||||
|
App::Instance()->node_id,
|
||||||
|
GAME_ID
|
||||||
|
});
|
||||||
|
masterserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/node%d/game%d.masterserver.cluster.json",
|
||||||
|
{
|
||||||
|
GAME_ID,
|
||||||
|
App::Instance()->node_id,
|
||||||
|
GAME_ID
|
||||||
|
});
|
||||||
|
targetserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/node%d/game%d.gameserver.cluster.json",
|
||||||
|
{
|
||||||
|
GAME_ID,
|
||||||
|
App::Instance()->node_id,
|
||||||
|
GAME_ID
|
||||||
|
});
|
||||||
|
#else
|
||||||
wsproxyserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.wsproxy.cluster.json",
|
wsproxyserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.wsproxy.cluster.json",
|
||||||
{GAME_ID, GAME_ID});
|
{GAME_ID, GAME_ID});
|
||||||
masterserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.masterserver.cluster.json",
|
masterserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.masterserver.cluster.json",
|
||||||
{GAME_ID, GAME_ID});
|
{GAME_ID, GAME_ID});
|
||||||
targetserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.gameserver.cluster.json",
|
targetserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.gameserver.cluster.json",
|
||||||
{GAME_ID, GAME_ID});
|
{GAME_ID, GAME_ID});
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
wsproxyserver_cluster_json_.ReadFromFile(wsproxyserver_cluster_json_file);
|
wsproxyserver_cluster_json_.ReadFromFile(wsproxyserver_cluster_json_file);
|
||||||
#if MASTER_MODE
|
#if MASTER_MODE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user