conf.setRequiredOptionNames(requiredOptions);
string confFile = confDir + "/stargazer.conf";
-//printfd(__FILE__, "Conffile: %s\n", confFile.c_str());
-
if(conf.setContent(confFile.c_str()) != 0)
{
strError = "Cannot read file " + confFile;
if (strcasecmp(node->getName(), "ScriptDir") == 0)
{
scriptsDir = node->getValue(0);
- //printfd(__FILE__, "LogFile: %s\n", logFile.c_str());
}
if (strcasecmp(node->getName(), "LogFile") == 0)
{
logFile = node->getValue(0);
- //printfd(__FILE__, "LogFile: %s\n", logFile.c_str());
}
if (strcasecmp(node->getName(), "PIDFile") == 0)
{
pidFile = node->getValue(0);
- //printfd(__FILE__, "PIDFile: %s\n", pidFile.c_str());
}
if (strcasecmp(node->getName(), "ModulesPath") == 0)
{
modulesPath = node->getValue(0);
- //printfd(__FILE__, "ModulesPath: %s\n", logFile.c_str());
}
if (strcasecmp(node->getName(), "Rules") == 0)
{
rules = node->getValue(0);
- //printfd(__FILE__, "Rules: %s\n", rules.c_str());
}
if (strcasecmp(node->getName(), "DetailStatWritePeriod") == 0)
strError = "Incorrect DetailStatWritePeriod value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "DetailStatWritePeriod: %d\n", detailStatWritePeriod);
}
if (strcasecmp(node->getName(), "StatWritePeriod") == 0)
strError = "Incorrect StatWritePeriod value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "StatWritePeriod: %d\n", statWritePeriod);
}
if (strcasecmp(node->getName(), "ExecMsgKey") == 0)
strError = "Incorrect ExecutersNum value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "DayResetTraff: %d\n", dayResetTraff);
}
if (strcasecmp(node->getName(), "DayFee") == 0)
strError = "Incorrect DayFee value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "DayFee: %d\n", dayFee);
}
if (strcasecmp(node->getName(), "FullFee") == 0)
strError = "Incorrect FullFee value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "DayFee: %d\n", dayFee);
}
if (strcasecmp(node->getName(), "DayResetTraff") == 0)
strError = "Incorrect DayResetTraff value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "DayResetTraff: %d\n", dayResetTraff);
}
if (strcasecmp(node->getName(), "SpreadFee") == 0)
strError = "Incorrect SpreadFee value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "SpreadFee: %d\n", spreadFee);
}
if (strcasecmp(node->getName(), "FreeMbAllowInet") == 0)
strError = "Incorrect FreeMbAllowInet value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "FreeMbAllowInet: %d\n", freeMbAllowInet);
}
if (strcasecmp(node->getName(), "DayFeeIsLastDay") == 0)
strError = "Incorrect DayFeeIsLastDay value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "DayFeeIsLastDay: %d\n", dayFeeIsLastDay);
}
if (strcasecmp(node->getName(), "WriteFreeMbTraffCost") == 0)
strError = "Incorrect WriteFreeMbTraffCost value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "WriteFreeMbTraffCost: %d\n", writeFreeMbTraffCost);
}
if (strcasecmp(node->getName(), "ShowFeeInCash") == 0)
strError = "Incorrect ShowFeeInCash value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "ShowFeeInCash: %d\n", showFeeInCash);
}
if (strcasecmp(node->getName(), "MonitorDir") == 0)
strError = "Incorrect MessageTimeout value: \'" + string(node->getValue(0)) + "\'";
return -1;
}
- //printfd(__FILE__, "MessageTimeout: %d\n", messageTimeout);
}
if (strcasecmp(node->getName(), "DirNames") == 0)
{
- // íÙ ×ÎÕÔÒÉ ÓÅËÃÉÉ DirNames
const DOTCONFDocumentNode * child = node->getChildNode();
if (child)
{
if (strcasecmp(node->getName(), "StoreModule") == 0)
{
- // íÙ ×ÎÕÔÒÉ ÓÅËÃÉÉ StoreModule
- //printfd(__FILE__, "StoreModule\n");
-
if (node->getValue(1))
{
- // StoreModule ÄÏÌÖÅÎ ÉÍÅÔØ 1 ÁÔÒÉÂÕÔ
strError = "Unexpected \'" + string(node->getValue(1)) + "\'.";
return -1;
}
if (storeModulesCount)
{
- // äÏÌÖÅÎ ÂÙÔØ ÔÏÌØËÏ ÏÄÉÎ ÍÏÄÕÌØ StoreModule!
strError = "Should be only one StoreModule.";
return -1;
}
ParseModuleSettings(node, &storeModuleSettings.moduleParams);
}
- // þÉÔÁÅÍ ÎÁÓÔÒÏÊËÉ ×ÓÅÈ ÏÓÔÁ×ÛÉÈÓÑ ÍÏÄÕÌÅÊ.
if (strcasecmp(node->getName(), "Modules") == 0)
{
- // íÙ ×ÎÕÔÒÉ ÓÅËÃÉÉ Modules
if (node->getValue(0))
{
- // Modules ÎÅ ÄÏÌÖÅÎ ÉÍÅÔØ ÁÔÒÉÂÕÏ×
strError = "Unexpected \'" + string(node->getValue(0)) + "\'.";
return -1;
}
const DOTCONFDocumentNode * child = node->getChildNode();
while (child)
{
- // íÙ ×ÎÕÔÒÉ ÓÅËÃÉÉ
if (strcasecmp(child->getName(), "Module") != 0)
{
child = child->getNextNode();
unsigned GetMessageTimeout() const { return messageTimeout * 3600 * 24; }
const std::string & GetModulesPath() const { return modulesPath; }
- const MODULE_SETTINGS & GetStoreModuleSettings() const
+ const MODULE_SETTINGS & GetStoreModuleSettings() const
{ return storeModuleSettings; }
const std::vector<MODULE_SETTINGS> & GetModulesSettings() const
{ return modulesSettings; }
static void ErrorCallback(void * data, const char * buf);
std::string strError;
+
//////////settings
std::string modulesPath;
std::string dirName[DIR_NUM];
int stgExecMsgKey;
unsigned executersNum;
bool fullFee;
- unsigned dayFee; // ÄÅÎØ ÓÎÑÔÉÑ ÁÂÏÎÐÌÁÔÙ
- unsigned dayResetTraff; // îÁÞÁÌÏ ÕÞÅÔÎÏÇÏ ÐÅÒÉÏÄÁ: ÄÅÎØ ÏÂÎÕÌÅÎÉÑ ÔÒÁÆÉËÁ É ÓÍÅÎÙ ÔÁÒÉÆÁ
+ unsigned dayFee;
+ unsigned dayResetTraff;
bool spreadFee;
bool freeMbAllowInet;
- bool dayFeeIsLastDay; // áð ÓÎÉÍÁÅÔÓÑ × ËÏÎÃÅ ÍÅÓÑÃÁ (true) ÉÌÉ × ÎÁÞÁÌÅ (false)
- bool writeFreeMbTraffCost; // ðÉÓÁÔØ × ÄÅÔÁÌØÎÕÀ ÓÔÁÔÉÓÔÉËÕ ÓÔÏÉÍÏÓÔØ ÔÒÁÆÉËÁ, ÅÓÌÉ ÅÝÅ ÅÓÔØ ÐÒÅÄÏÐÌÁÞÅÎÎÙÊ ÔÒÁÆÉË
- bool showFeeInCash; // ðÏËÁÚÙ×ÁÔØ ÐÏÌØÚÏ×ÁÔÅÌÀ áð ÎÅ ÓÞÅÔÕ É ÐÏÚ×ÏÌÑÔØ ÅÅ ÉÓÐÏÌØÚÏ×ÁÔØ
- unsigned messageTimeout; // ÷ÒÅÍÑ ÖÉÚÎÉ ÎÅÏÔÐÒÁ×ÌÅÎÎÏÇÏ ÓÏÏÂÝÅÎÉÑ × ÓÅËÕÎÄÁÈ
+ bool dayFeeIsLastDay;
+ bool writeFreeMbTraffCost;
+ bool showFeeInCash;
+ unsigned messageTimeout;
std::vector<MODULE_SETTINGS> modulesSettings;
MODULE_SETTINGS storeModuleSettings;
STG_LOGGER & logger;
};
//-----------------------------------------------------------------------------
+
#endif