Store server database config in config file.
This commit is contained in:
@@ -50,7 +50,7 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
|
|||||||
myConfigState = OK;
|
myConfigState = OK;
|
||||||
|
|
||||||
// !!!! Revisionsnummer der Configdefaults !!!!!
|
// !!!! Revisionsnummer der Configdefaults !!!!!
|
||||||
configRev = 83;
|
configRev = 84;
|
||||||
|
|
||||||
//standard defaults
|
//standard defaults
|
||||||
logOnOffDefault = "1";
|
logOnOffDefault = "1";
|
||||||
@@ -274,6 +274,11 @@ ConfigFile::ConfigFile(char *argv0, bool readonly) : noWriteAccess(readonly)
|
|||||||
configList.push_back(ConfigInfo("InternetSavePassword", CONFIG_TYPE_INT, "0"));
|
configList.push_back(ConfigInfo("InternetSavePassword", CONFIG_TYPE_INT, "0"));
|
||||||
configList.push_back(ConfigInfo("IfInfoMessageShowList", CONFIG_TYPE_STRING_LIST, "Msg"));
|
configList.push_back(ConfigInfo("IfInfoMessageShowList", CONFIG_TYPE_STRING_LIST, "Msg"));
|
||||||
configList.push_back(ConfigInfo("PlayerIgnoreList", CONFIG_TYPE_STRING_LIST, "Player"));
|
configList.push_back(ConfigInfo("PlayerIgnoreList", CONFIG_TYPE_STRING_LIST, "Player"));
|
||||||
|
configList.push_back(ConfigInfo("DBServerAddress", CONFIG_TYPE_STRING, "127.0.0.1"));
|
||||||
|
configList.push_back(ConfigInfo("DBServerUser", CONFIG_TYPE_STRING, "pokerth"));
|
||||||
|
configList.push_back(ConfigInfo("DBServerPassword", CONFIG_TYPE_STRING, ""));
|
||||||
|
configList.push_back(ConfigInfo("DBServerDatabaseName", CONFIG_TYPE_STRING, "pokerth"));
|
||||||
|
configList.push_back(ConfigInfo("DBServerEncryptionKey", CONFIG_TYPE_STRING, ""));
|
||||||
|
|
||||||
//fill tempList firstTime
|
//fill tempList firstTime
|
||||||
configBufferList = configList;
|
configBufferList = configList;
|
||||||
|
|||||||
@@ -161,10 +161,10 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
ServerLobbyThread::ServerLobbyThread(GuiInterface &gui, ServerMode mode, ServerIrcBotCallback &ircBotCb, ConfigFile *playerConfig,
|
ServerLobbyThread::ServerLobbyThread(GuiInterface &gui, ServerMode mode, ServerIrcBotCallback &ircBotCb, ConfigFile *serverConfig,
|
||||||
AvatarManager &avatarManager, boost::shared_ptr<boost::asio::io_service> ioService)
|
AvatarManager &avatarManager, boost::shared_ptr<boost::asio::io_service> ioService)
|
||||||
: m_ioService(ioService), m_authContext(NULL), m_gui(gui), m_ircBotCb(ircBotCb), m_avatarManager(avatarManager),
|
: m_ioService(ioService), m_authContext(NULL), m_gui(gui), m_ircBotCb(ircBotCb), m_avatarManager(avatarManager),
|
||||||
m_mode(mode), m_playerConfig(playerConfig), m_curGameId(0), m_curUniquePlayerId(0), m_curSessionId(INVALID_SESSION + 1),
|
m_mode(mode), m_serverConfig(serverConfig), m_curGameId(0), m_curUniquePlayerId(0), m_curSessionId(INVALID_SESSION + 1),
|
||||||
m_statDataChanged(false), m_removeGameTimer(*ioService), m_removePlayerTimer(*ioService),
|
m_statDataChanged(false), m_removeGameTimer(*ioService), m_removePlayerTimer(*ioService),
|
||||||
m_sessionTimeoutTimer(*ioService), m_avatarCleanupTimer(*ioService),
|
m_sessionTimeoutTimer(*ioService), m_avatarCleanupTimer(*ioService),
|
||||||
m_saveStatisticsTimer(*ioService), m_loginLockTimer(*ioService),
|
m_saveStatisticsTimer(*ioService), m_loginLockTimer(*ioService),
|
||||||
@@ -197,7 +197,12 @@ ServerLobbyThread::Init(const string &logDir)
|
|||||||
ReadStatisticsFile();
|
ReadStatisticsFile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_database->Init("127.0.0.1", "user", "password", "database", "key");
|
m_database->Init(
|
||||||
|
m_serverConfig->readConfigString("DBServerAddress"),
|
||||||
|
m_serverConfig->readConfigString("DBServerUser"),
|
||||||
|
m_serverConfig->readConfigString("DBServerPassword"),
|
||||||
|
m_serverConfig->readConfigString("DBServerDatabaseName"),
|
||||||
|
m_serverConfig->readConfigString("DBServerEncryptionKey"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -788,14 +793,14 @@ ServerLobbyThread::ClearAuthContext()
|
|||||||
void
|
void
|
||||||
ServerLobbyThread::InitChatCleaner()
|
ServerLobbyThread::InitChatCleaner()
|
||||||
{
|
{
|
||||||
if (m_playerConfig->readConfigInt("UseChatCleaner") != 0)
|
if (m_serverConfig->readConfigInt("UseChatCleaner") != 0)
|
||||||
{
|
{
|
||||||
m_chatCleanerManager->Init(
|
m_chatCleanerManager->Init(
|
||||||
m_playerConfig->readConfigString("ChatCleanerHostAddress"),
|
m_serverConfig->readConfigString("ChatCleanerHostAddress"),
|
||||||
m_playerConfig->readConfigInt("ChatCleanerPort"),
|
m_serverConfig->readConfigInt("ChatCleanerPort"),
|
||||||
m_playerConfig->readConfigInt("ChatCleanerUseIpv6") != 0,
|
m_serverConfig->readConfigInt("ChatCleanerUseIpv6") != 0,
|
||||||
m_playerConfig->readConfigString("ChatCleanerClientAuth"),
|
m_serverConfig->readConfigString("ChatCleanerClientAuth"),
|
||||||
m_playerConfig->readConfigString("ChatCleanerServerAuth"));
|
m_serverConfig->readConfigString("ChatCleanerServerAuth"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1345,7 +1350,7 @@ ServerLobbyThread::HandleNetPacketCreateGame(SessionWrapper session, const std::
|
|||||||
tmpData,
|
tmpData,
|
||||||
session.playerData->GetUniqueId(),
|
session.playerData->GetUniqueId(),
|
||||||
GetGui(),
|
GetGui(),
|
||||||
m_playerConfig));
|
m_serverConfig));
|
||||||
game->Init();
|
game->Init();
|
||||||
|
|
||||||
// Add game to list of games.
|
// Add game to list of games.
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ struct Gsasl;
|
|||||||
class ServerLobbyThread : public Thread, public boost::enable_shared_from_this<ServerLobbyThread>
|
class ServerLobbyThread : public Thread, public boost::enable_shared_from_this<ServerLobbyThread>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ServerLobbyThread(GuiInterface &gui, ServerMode mode, ServerIrcBotCallback &ircBotCb, ConfigFile *playerConfig, AvatarManager &avatarManager,
|
ServerLobbyThread(GuiInterface &gui, ServerMode mode, ServerIrcBotCallback &ircBotCb, ConfigFile *serverConfig, AvatarManager &avatarManager,
|
||||||
boost::shared_ptr<boost::asio::io_service> ioService);
|
boost::shared_ptr<boost::asio::io_service> ioService);
|
||||||
virtual ~ServerLobbyThread();
|
virtual ~ServerLobbyThread();
|
||||||
|
|
||||||
@@ -225,7 +225,7 @@ private:
|
|||||||
|
|
||||||
ServerMode m_mode;
|
ServerMode m_mode;
|
||||||
std::string m_statisticsFileName;
|
std::string m_statisticsFileName;
|
||||||
ConfigFile *m_playerConfig;
|
ConfigFile *m_serverConfig;
|
||||||
u_int32_t m_curGameId;
|
u_int32_t m_curGameId;
|
||||||
|
|
||||||
u_int32_t m_curUniquePlayerId;
|
u_int32_t m_curUniquePlayerId;
|
||||||
|
|||||||
Reference in New Issue
Block a user