This commit is contained in:
aozhiwei 2019-12-13 13:06:04 +08:00
parent 7f7e773ab2
commit ab595fbafb
2 changed files with 52 additions and 49 deletions

View File

@ -11,56 +11,58 @@ void JsonDataMgr::Init()
node_host_mutex_ = new std::mutex();
#endif
std::string wsproxyserver_cluster_json_file;
std::string masterserver_cluster_json_file;
std::string targetserver_cluster_json_file;
std::string routing_tables_json_file;
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
});
routing_tables_json_file = a8::Format("../config/routing_tables.json",
{
});
#else
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});
#endif
} else {
#if 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
});
routing_tables_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/routing_tables.json",
{
GAME_ID
});
#else
wsproxyserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.wsproxy.cluster.json",
{GAME_ID, GAME_ID});
masterserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.masterserver.cluster.json",
{GAME_ID, GAME_ID});
targetserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/wsproxy/game%d.gameserver.cluster.json",
{GAME_ID, GAME_ID});
#endif
if (!f8::IsOnlineEnv()) {
if (f8::IsTestEnv()) {
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/wsproxy.test",
{
GAME_ID,
App::Instance()->instance_id,
GAME_ID
});
} else {
work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/wsproxy.dev",
{
GAME_ID,
App::Instance()->instance_id,
GAME_ID
});
}
}
std::string wsproxyserver_cluster_json_file;
#if MASTER_MODE
std::string masterserver_cluster_json_file;
std::string routing_tables_json_file;
wsproxyserver_cluster_json_file = a8::Format("%s/node%d/game%d.wsproxy.cluster.json",
{
work_path_,
GAME_ID,
App::Instance()->node_id,
GAME_ID
});
masterserver_cluster_json_file = a8::Format("%s/node%d/game%d.masterserver.cluster.json",
{
work_path_,
GAME_ID,
App::Instance()->node_id,
GAME_ID
});
routing_tables_json_file = a8::Format("%s/routing_tables.json",
{
GAME_ID
});
#else
std::string targetserver_cluster_json_file;
wsproxyserver_cluster_json_file = a8::Format("%s/game%d.wsproxy.cluster.json",
{
GAME_ID
});
targetserver_cluster_json_file = a8::Format("%s/game%d.gameserver.cluster.json",
{
GAME_ID
});
#endif
wsproxyserver_cluster_json_.ReadFromFile(wsproxyserver_cluster_json_file);
#if MASTER_MODE
masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file);

View File

@ -19,6 +19,7 @@ class JsonDataMgr : public a8::Singleton<JsonDataMgr>
#endif
private:
std::string work_path_ = "../config";
a8::XObject wsproxyserver_cluster_json_;
a8::XObject masterserver_cluster_json_;
#if MASTER_MODE