From 816b1aedf2ce38fbef60467f61a268511b6cfa58 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 2 Oct 2023 12:24:43 +0800 Subject: [PATCH] 1 --- server/wsproxy/jsondatamgr.cc | 16 +++++++++++----- server/wsproxy/jsondatamgr.h | 1 + 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/server/wsproxy/jsondatamgr.cc b/server/wsproxy/jsondatamgr.cc index 149ebe9..d7a0aae 100644 --- a/server/wsproxy/jsondatamgr.cc +++ b/server/wsproxy/jsondatamgr.cc @@ -8,31 +8,37 @@ #include "jsondatamgr.h" #include "app.h" -static const char* WORK_PATH = "../config"; - void JsonDataMgr::Init() { + if (!f8::IsOnlineEnv()) { + if (f8::IsTestEnv()) { + work_path_ = a8::Format("../%d_test_config", {GAME_ID}); + } else { + work_path_ = a8::Format("../%d_dev_config", {GAME_ID}); + } + } + std::string wsproxy_cluster_json_file; std::string master_cluster_json_file; std::string kcp_conf_json_file; wsproxy_cluster_json_file = a8::Format ("%s/zone%d/node%d/wsproxy.cluster.json", { - WORK_PATH, + work_path_, f8::App::Instance()->GetZoneId(), f8::App::Instance()->GetNodeId() }); master_cluster_json_file = a8::Format ("%s/zone%d/node%d/masterserver.cluster.json", { - WORK_PATH, + work_path_, f8::App::Instance()->GetZoneId(), f8::App::Instance()->GetNodeId(), }); kcp_conf_json_file = a8::Format ("%s/zone%d/node%d/kcp_conf.json", { - WORK_PATH, + work_path_, f8::App::Instance()->GetZoneId(), f8::App::Instance()->GetNodeId(), }); diff --git a/server/wsproxy/jsondatamgr.h b/server/wsproxy/jsondatamgr.h index 6986fcb..a2bc1b6 100644 --- a/server/wsproxy/jsondatamgr.h +++ b/server/wsproxy/jsondatamgr.h @@ -36,6 +36,7 @@ class JsonDataMgr : public a8::Singleton void SetKcpSwitch(int is_open); private: + std::string work_path_ = "../config"; a8::XObject wsproxy_cluster_json_; a8::XObject master_cluster_json_; a8::XObject kcp_conf_json_;