This commit is contained in:
aozhiwei 2019-12-13 13:41:32 +08:00
parent 6169fc61b5
commit d7555020b9
2 changed files with 21 additions and 23 deletions

View File

@ -9,32 +9,28 @@ void JsonDataMgr::Init()
{ {
std::string masterserver_cluster_json_file; std::string masterserver_cluster_json_file;
if (!f8::IsOnlineEnv()) { if (!f8::IsOnlineEnv()) {
if (App::Instance()->flags.find(2) != App::Instance()->flags.end()) { if (f8::IsTestEnv()) {
masterserver_cluster_json_file = a8::Format("/root/pub/%d/%d/conf_test/game%d/masterserver/node%d/" work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/masterserver.test",
"game%d.masterserver.cluster.json",
{ {
GAME_ID, GAME_ID,
App::Instance()->instance_id, App::Instance()->instance_id,
GAME_ID,
App::Instance()->node_id,
GAME_ID GAME_ID
}); });
} else { } else {
masterserver_cluster_json_file = a8::Format("/var/data/conf_test/game%d/masterserver/node%d/" work_path_ = a8::Format("/root/pub/%d/%d/conf_test/game%d/masterserver.dev",
"game%d.masterserver.cluster.json",
{ {
GAME_ID, GAME_ID,
App::Instance()->node_id, App::Instance()->instance_id,
GAME_ID GAME_ID
}); });
} }
} else { }
masterserver_cluster_json_file = a8::Format("../config/node%d/game%d.masterserver.cluster.json", masterserver_cluster_json_file = a8::Format("%s/node%d/game%d.masterserver.cluster.json",
{ {
work_path_,
App::Instance()->node_id, App::Instance()->node_id,
GAME_ID GAME_ID
}); });
}
masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file); masterserver_cluster_json_.ReadFromFile(masterserver_cluster_json_file);
} }

View File

@ -14,6 +14,8 @@ class JsonDataMgr : public a8::Singleton<JsonDataMgr>
std::string ip; std::string ip;
int listen_port = 0; int listen_port = 0;
private: private:
std::string work_path_ = "../config";
a8::XObject masterserver_cluster_json_; a8::XObject masterserver_cluster_json_;
}; };