From dbd3b93cbc881d0946b9e6552b6115620b6a09fa Mon Sep 17 00:00:00 2001 From: Andreas Joachim Peters Date: Mon, 10 Jun 2024 22:47:59 +0200 Subject: [PATCH] XrdApps::JCache: add environment variables to overwrite configuration settings on the fly (atleast the plug-in has to be enabled!) --- .../plugin/XrdClJCachePlugin.hh | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/XrdApps/XrdClJCachePlugin/plugin/XrdClJCachePlugin.hh b/src/XrdApps/XrdClJCachePlugin/plugin/XrdClJCachePlugin.hh index 640405588db..a174e105b63 100644 --- a/src/XrdApps/XrdClJCachePlugin/plugin/XrdClJCachePlugin.hh +++ b/src/XrdApps/XrdClJCachePlugin/plugin/XrdClJCachePlugin.hh @@ -61,10 +61,37 @@ class JCacheFactory : public PlugInFactory JCacheFile::SetJsonPath( itjson != config->end() ? itjson->second : "./" ); auto its = config->find( "summary" ); JCacheFile::SetSummary( its != config->end() ? its->second != "false": true ); + + if (const char *v = getenv("XRD_JCACHE_CACHE")) { + JCacheFile::SetCache( (std::string(v).length()) ? std::string(v) : ""); + } + + if (const char *v = getenv("XRD_JCACHE_SUMMARY")) { + JCacheFile::SetSummary( (std::string(v) == "true") ? true : false); + } + + if (const char *v = getenv("XRD_JCACHE_JOURNAL")) { + JCacheFile::SetJournal( (std::string(v) == "true") ? true : false); + } + + if (const char *v = getenv("XRD_JCACHE_VECTOR")) { + JCacheFile::SetVector( (std::string(v) == "true") ? true : false); + } + + if (const char *v = getenv("XRD_JCACHE_JSON")) { + JCacheFile::SetJsonPath( (std::string(v).length()) ? std::string(v) : ""); + } + Log* log = DefaultEnv::GetLog(); log->Info(1, "JCache : cache directory: %s", JCacheFile::sCachePath.c_str()); log->Info(1, "JCache : caching readv in vector cache : %s", JCacheFile::sEnableVectorCache ? "true" : "false"); log->Info(1, "JCache : caching reads in journal cache: %s", JCacheFile::sEnableJournalCache ? "true" : "false"); + log->Info(1, "JCache : summary output is: %s", JCacheFile::sEnableSummary ? "true" : "false"); + if (JCacheFile::sJsonPath.length()) { + log->Info(1, "JCache : json output to prefix: %s", JCacheFile::sJsonPath.c_str()); + } else { + log->Info(1, "JCache : json output is disabled", JCacheFile::sJsonPath.c_str()); + } } }