X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/bf69e959b3e75cb3eb3748e93df9dcfe5b82aa17..722a4fd38336dab14e00cb60c9e0c17867a0240e:/projects/stargazer/settings.cpp diff --git a/projects/stargazer/settings.cpp b/projects/stargazer/settings.cpp index 7aa2950f..8af7f7aa 100644 --- a/projects/stargazer/settings.cpp +++ b/projects/stargazer/settings.cpp @@ -41,7 +41,7 @@ using namespace std; //----------------------------------------------------------------------------- SETTINGS::SETTINGS() : confDir("/etc/stargazer"), - scriptDir("/etc/stargazer"), + scriptsDir("/etc/stargazer"), pidFile("/var/run/stargazer.pid"), monitoring(false), detailStatWritePeriod(dsPeriod_1_6), @@ -63,7 +63,7 @@ SETTINGS::SETTINGS() //----------------------------------------------------------------------------- SETTINGS::SETTINGS(const std::string & cd) : confDir(cd), - scriptDir(cd), + scriptsDir(cd), monitoring(false), detailStatWritePeriod(dsPeriod_1_6), statWritePeriod(10), @@ -84,7 +84,7 @@ SETTINGS::SETTINGS(const std::string & cd) //----------------------------------------------------------------------------- SETTINGS::SETTINGS(const SETTINGS & rval) : confDir(rval.confDir), - scriptDir(rval.scriptDir), + scriptsDir(rval.scriptsDir), pidFile(rval.pidFile), monitoring(rval.monitoring), detailStatWritePeriod(dsPeriod_1_6), @@ -244,8 +244,6 @@ conf.setErrorCallback(SETTINGS::ErrorCallback, this); 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; @@ -258,32 +256,27 @@ while (node) { if (strcasecmp(node->getName(), "ScriptDir") == 0) { - scriptDir = node->getValue(0); - //printfd(__FILE__, "LogFile: %s\n", logFile.c_str()); + scriptsDir = node->getValue(0); } 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) @@ -293,7 +286,6 @@ while (node) strError = "Incorrect DetailStatWritePeriod value: \'" + string(node->getValue(0)) + "\'"; return -1; } - //printfd(__FILE__, "DetailStatWritePeriod: %d\n", detailStatWritePeriod); } if (strcasecmp(node->getName(), "StatWritePeriod") == 0) @@ -303,7 +295,6 @@ while (node) strError = "Incorrect StatWritePeriod value: \'" + string(node->getValue(0)) + "\'"; return -1; } - //printfd(__FILE__, "StatWritePeriod: %d\n", statWritePeriod); } if (strcasecmp(node->getName(), "ExecMsgKey") == 0) @@ -322,7 +313,6 @@ while (node) strError = "Incorrect ExecutersNum value: \'" + string(node->getValue(0)) + "\'"; return -1; } - //printfd(__FILE__, "DayResetTraff: %d\n", dayResetTraff); } if (strcasecmp(node->getName(), "DayFee") == 0) @@ -332,7 +322,6 @@ while (node) strError = "Incorrect DayFee value: \'" + string(node->getValue(0)) + "\'"; return -1; } - //printfd(__FILE__, "DayFee: %d\n", dayFee); } if (strcasecmp(node->getName(), "FullFee") == 0) @@ -342,7 +331,6 @@ while (node) strError = "Incorrect FullFee value: \'" + string(node->getValue(0)) + "\'"; return -1; } - //printfd(__FILE__, "DayFee: %d\n", dayFee); } if (strcasecmp(node->getName(), "DayResetTraff") == 0) @@ -352,7 +340,6 @@ while (node) strError = "Incorrect DayResetTraff value: \'" + string(node->getValue(0)) + "\'"; return -1; } - //printfd(__FILE__, "DayResetTraff: %d\n", dayResetTraff); } if (strcasecmp(node->getName(), "SpreadFee") == 0) @@ -362,7 +349,6 @@ while (node) strError = "Incorrect SpreadFee value: \'" + string(node->getValue(0)) + "\'"; return -1; } - //printfd(__FILE__, "SpreadFee: %d\n", spreadFee); } if (strcasecmp(node->getName(), "FreeMbAllowInet") == 0) @@ -372,7 +358,6 @@ while (node) strError = "Incorrect FreeMbAllowInet value: \'" + string(node->getValue(0)) + "\'"; return -1; } - //printfd(__FILE__, "FreeMbAllowInet: %d\n", freeMbAllowInet); } if (strcasecmp(node->getName(), "DayFeeIsLastDay") == 0) @@ -382,7 +367,6 @@ while (node) strError = "Incorrect DayFeeIsLastDay value: \'" + string(node->getValue(0)) + "\'"; return -1; } - //printfd(__FILE__, "DayFeeIsLastDay: %d\n", dayFeeIsLastDay); } if (strcasecmp(node->getName(), "WriteFreeMbTraffCost") == 0) @@ -392,7 +376,6 @@ while (node) strError = "Incorrect WriteFreeMbTraffCost value: \'" + string(node->getValue(0)) + "\'"; return -1; } - //printfd(__FILE__, "WriteFreeMbTraffCost: %d\n", writeFreeMbTraffCost); } if (strcasecmp(node->getName(), "ShowFeeInCash") == 0) @@ -402,7 +385,6 @@ while (node) strError = "Incorrect ShowFeeInCash value: \'" + string(node->getValue(0)) + "\'"; return -1; } - //printfd(__FILE__, "ShowFeeInCash: %d\n", showFeeInCash); } if (strcasecmp(node->getName(), "MonitorDir") == 0) @@ -424,12 +406,10 @@ while (node) 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) { @@ -449,19 +429,14 @@ while (node) 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; } @@ -471,20 +446,16 @@ while (node) 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();