From: Naffanya Date: Fri, 24 May 2013 23:18:54 +0000 (+0300) Subject: First stage of ticket 10 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/37925a173b073b547ffc7dd7412de658accf694c First stage of ticket 10 --- diff --git a/include/stg/settings.h b/include/stg/settings.h index d23494bc..38543988 100644 --- a/include/stg/settings.h +++ b/include/stg/settings.h @@ -26,23 +26,24 @@ class SETTINGS { public: virtual ~SETTINGS() {} - virtual const std::string & GetDirName(size_t num) const = 0; - virtual const std::string & GetScriptsDir() const = 0; - virtual unsigned GetDetailStatWritePeriod() const = 0; - virtual unsigned GetStatWritePeriod() const = 0; - virtual unsigned GetDayFee() const = 0; - virtual bool GetFullFee() const = 0; - virtual unsigned GetDayResetTraff() const = 0; - virtual bool GetSpreadFee() const = 0; - virtual bool GetFreeMbAllowInet() const = 0; - virtual bool GetDayFeeIsLastDay() const = 0; - virtual bool GetWriteFreeMbTraffCost() const = 0; - virtual bool GetShowFeeInCash() const = 0; - virtual unsigned GetMessageTimeout() const = 0; - virtual unsigned GetFeeChargeType() const = 0; - virtual bool GetReconnectOnTariffChange() const = 0; - virtual const std::string & GetMonitorDir() const = 0; - virtual bool GetMonitoring() const = 0; + virtual const std::string & GetDirName(size_t num) const = 0; + virtual const std::string & GetScriptsDir() const = 0; + virtual unsigned GetDetailStatWritePeriod() const = 0; + virtual unsigned GetStatWritePeriod() const = 0; + virtual unsigned GetDayFee() const = 0; + virtual bool GetFullFee() const = 0; + virtual unsigned GetDayResetTraff() const = 0; + virtual bool GetSpreadFee() const = 0; + virtual bool GetFreeMbAllowInet() const = 0; + virtual bool GetDayFeeIsLastDay() const = 0; + virtual bool GetWriteFreeMbTraffCost() const = 0; + virtual bool GetShowFeeInCash() const = 0; + virtual unsigned GetMessageTimeout() const = 0; + virtual unsigned GetFeeChargeType() const = 0; + virtual bool GetReconnectOnTariffChange() const = 0; + virtual const std::string & GetMonitorDir() const = 0; + virtual bool GetMonitoring() const = 0; + virtual const std::vector & GetScriptParams() const = 0; }; //----------------------------------------------------------------------------- diff --git a/projects/stargazer/main.cpp b/projects/stargazer/main.cpp index eb61e2d5..c7bfb4aa 100644 --- a/projects/stargazer/main.cpp +++ b/projects/stargazer/main.cpp @@ -264,14 +264,24 @@ else if (settings->ReadSettings()) { STG_LOGGER & WriteServLog = GetStgLogger(); - if (settings->GetLogFileName() != "") WriteServLog.SetLogFileName(settings->GetLogFileName()); WriteServLog("ReadSettings error. %s", settings->GetStrError().c_str()); exit(1); } - +/*************************************************************************************************/ +//вывод scriptParams + printfd(__FILE__, "--- Script params dump ---\n"); + std::vector::const_iterator it(settings->GetScriptParams().begin()); + while (it != settings->GetScriptParams().end()) + { + printfd(__FILE__, "%s\n", it->c_str()); + it++; + } + printfd(__FILE__, "--- End dump ---\n"); +/*************************************************************************************************/ + #ifndef NO_DAEMON std::string startFile(settings->GetConfDir() + START_FILE); #endif diff --git a/projects/stargazer/settings_impl.cpp b/projects/stargazer/settings_impl.cpp index 16a2ac47..8e4accee 100644 --- a/projects/stargazer/settings_impl.cpp +++ b/projects/stargazer/settings_impl.cpp @@ -243,7 +243,7 @@ while (node) { rules = node->getValue(0); } - + if (strcasecmp(node->getName(), "DetailStatWritePeriod") == 0) { if (ParseDetailStatWritePeriod(node->getValue(0)) != 0) @@ -457,6 +457,16 @@ while (node) } } + if (strcasecmp(node->getName(), "ScriptParams") == 0) + { + int i; + i=0; + while (node->getValue(i)!=NULL) + { + scriptParams.push_back(node->getValue(i)); + i++; + } + } node = node->getNextNode(); } @@ -488,4 +498,4 @@ else if (detailStatPeriodStr == "1/6") return -1; } -//----------------------------------------------------------------------------- +//----------------------------------------------------------------------------- \ No newline at end of file diff --git a/projects/stargazer/settings_impl.h b/projects/stargazer/settings_impl.h index 4a048333..3bee1547 100644 --- a/projects/stargazer/settings_impl.h +++ b/projects/stargazer/settings_impl.h @@ -98,6 +98,8 @@ public: { return storeModuleSettings; } const std::vector & GetModulesSettings() const { return modulesSettings; } + + const std::vector & GetScriptParams() const {return scriptParams; } private: @@ -117,6 +119,9 @@ private: std::string logFile; std::string pidFile; std::string monitorDir; + + std::vector scriptParams; + bool monitoring; unsigned detailStatWritePeriod; unsigned statWritePeriod; @@ -136,7 +141,7 @@ private: std::vector modulesSettings; MODULE_SETTINGS storeModuleSettings; - + STG_LOGGER & logger; }; //-----------------------------------------------------------------------------