Mercurial > hg > orthanc
diff OrthancServer/Sources/OrthancConfiguration.cpp @ 4944:f377d5643538 more-tags
new Warnings configuration + InstanceAvailability tag
author | Alain Mazy <am@osimis.io> |
---|---|
date | Thu, 17 Mar 2022 17:03:59 +0100 |
parents | 96a3e81eba90 |
children | 877bc3b96476 |
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancConfiguration.cpp Wed Mar 16 09:50:33 2022 +0100 +++ b/OrthancServer/Sources/OrthancConfiguration.cpp Thu Mar 17 17:03:59 2022 +0100 @@ -43,6 +43,7 @@ static const char* const ORTHANC_PEERS_IN_DB = "OrthancPeersInDatabase"; static const char* const TEMPORARY_DIRECTORY = "TemporaryDirectory"; static const char* const DATABASE_SERVER_IDENTIFIER = "DatabaseServerIdentifier"; +static const char* const WARNINGS = "Warnings"; namespace Orthanc { @@ -1055,14 +1056,48 @@ } } - bool OrthancConfiguration::IsInconsistentDicomTagsLogsEnabled() const + void OrthancConfiguration::LoadWarnings() { - return GetBooleanParameter("EnableLogsForInconsistentMainDicomTags", true); - } + if (json_.isMember(WARNINGS)) + { + const Json::Value& warnings = json_[WARNINGS]; + if (!warnings.isObject()) + { + throw OrthancException(ErrorCode_BadFileFormat, std::string(WARNINGS) + " configuration entry is not a Json object"); + } + + Json::Value::Members members = warnings.getMemberNames(); + + for (size_t i = 0; i < members.size(); i++) + { + const std::string& name = members[i]; + bool enabled = warnings[name].asBool(); - bool OrthancConfiguration::IsStorageAccessOnFindLogsEnabled() const - { - return GetBooleanParameter("EnableLogsForStorageAccessOnFind", true); + Warnings warning = Warnings_None; + if (name == "W001_TagsBeingReadFromStorage") + { + warning = Warnings_001_TagsBeingReadFromStorage; + } + else if (name == "W002_InconsistentDicomTagsInDb") + { + warning = Warnings_002_InconsistentDicomTagsInDb; + } + else + { + throw OrthancException(ErrorCode_BadFileFormat, name + " is not recognized as a valid warning name"); + } + + if (!enabled) + { + disabledWarnings_.insert(warning); + } + } + } + else + { + disabledWarnings_.clear(); + } + }