diff --git a/lib/redis/rediswriter-objects.cpp b/lib/redis/rediswriter-objects.cpp index 447f9653a..8d889dd5b 100644 --- a/lib/redis/rediswriter-objects.cpp +++ b/lib/redis/rediswriter-objects.cpp @@ -43,11 +43,6 @@ void RedisWriter::ConfigStaticInitialize() ConfigObject::OnVersionChanged.connect(std::bind(&RedisWriter::VersionChangedHandler, _1)); } -static inline String GetIdentifier(const ConfigObject::Ptr& object) -{ - return object->GetName(); -} - void RedisWriter::UpdateAllConfigObjects(void) { AssertOnWorkQueue(); diff --git a/lib/redis/rediswriter-utility.cpp b/lib/redis/rediswriter-utility.cpp index 707fd69dd..ac480274e 100644 --- a/lib/redis/rediswriter-utility.cpp +++ b/lib/redis/rediswriter-utility.cpp @@ -25,6 +25,8 @@ #include "base/tlsutility.hpp" #include "base/initialize.hpp" #include "base/objectlock.hpp" +#include "base/array.hpp" +#include "base/scriptglobal.hpp" using namespace icinga; @@ -37,6 +39,13 @@ String RedisWriter::FormatCheckSumBinary(const String& str) return output; } +static Value l_DefaultEnv = "production"; + +String RedisWriter::GetIdentifier(const ConfigObject::Ptr& object) +{ + return HashValue((Array::Ptr)new Array({ScriptGlobal::Get("Environment", &l_DefaultEnv), object->GetName()})); +} + String RedisWriter::CalculateCheckSumString(const String& str) { return SHA1(str); diff --git a/lib/redis/rediswriter.hpp b/lib/redis/rediswriter.hpp index 9adf7dddb..7be55ace4 100644 --- a/lib/redis/rediswriter.hpp +++ b/lib/redis/rediswriter.hpp @@ -77,6 +77,7 @@ private: /* utilities */ static String FormatCheckSumBinary(const String& str); + static String GetIdentifier(const ConfigObject::Ptr& object); static String CalculateCheckSumString(const String& str); static String CalculateCheckSumGroups(const Array::Ptr& groups); static String CalculateCheckSumProperties(const ConfigObject::Ptr& object, const std::set& propertiesBlacklist);