|
|
@ -25,6 +25,8 @@ using namespace NLMISC;
|
|
|
|
using namespace NLNET;
|
|
|
|
using namespace NLNET;
|
|
|
|
|
|
|
|
|
|
|
|
CVariable<string> MongoPassword("mongo", "MongoPassword", "Set the password to access mongo", string(""), 0, true);
|
|
|
|
CVariable<string> MongoPassword("mongo", "MongoPassword", "Set the password to access mongo", string(""), 0, true);
|
|
|
|
|
|
|
|
CVariable<string> ChatDbName("mongo", "ChatDbName", "Set the mongo db", string(""), 0, true);
|
|
|
|
|
|
|
|
CVariable<string> ChatServer("mongo", "ChatServer", "Set the server host", string(""), 0, true);
|
|
|
|
|
|
|
|
|
|
|
|
DBClientConnection CMongo::conn(true);
|
|
|
|
DBClientConnection CMongo::conn(true);
|
|
|
|
string CMongo::dbname;
|
|
|
|
string CMongo::dbname;
|
|
|
@ -32,19 +34,18 @@ string CMongo::dbname;
|
|
|
|
|
|
|
|
|
|
|
|
void CMongo::init()
|
|
|
|
void CMongo::init()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (IService::getInstance()->getShardId() == 101)
|
|
|
|
dbname = ChatDbName.get();
|
|
|
|
dbname = "megacorp_live";
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
dbname = "megacorp_dev";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
bool res;
|
|
|
|
bool res;
|
|
|
|
string errmsg;
|
|
|
|
string errmsg;
|
|
|
|
|
|
|
|
|
|
|
|
res = conn.connect("chat.ryzom.com:22110", errmsg);
|
|
|
|
res = conn.connect(ChatServer.get(), errmsg);
|
|
|
|
if(!res) nlerror("mongo: init failed, cannot connect '%s'", errmsg.c_str());
|
|
|
|
if (!res)
|
|
|
|
else nlinfo("mongo: connection ok");
|
|
|
|
nlerror("mongo: init failed, cannot connect '%s'", errmsg.c_str());
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
nlinfo("mongo: connection ok");
|
|
|
|
|
|
|
|
|
|
|
|
/*res = conn.auth(dbname, "megacorp", MongoPassword.get(), errmsg);
|
|
|
|
/*res = conn.auth(dbname, "megacorp", MongoPassword.get(), errmsg);
|
|
|
|
if(!res) nlerror("mongo: init failed, cannot auth '%s'", errmsg.c_str());
|
|
|
|
if(!res) nlerror("mongo: init failed, cannot auth '%s'", errmsg.c_str());
|
|
|
|