Mercurial > hg > orthanc
changeset 7003:f931f34383db
configuration single source of truth: booleans
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Mon, 06 Jul 2026 16:33:25 +0200 |
| parents | 28683da53c6b |
| children | a890a3f0d2ac |
| files | OrthancServer/Sources/OrthancConfiguration.cpp OrthancServer/Sources/OrthancConfiguration.h OrthancServer/Sources/OrthancFindRequestHandler.cpp OrthancServer/Sources/OrthancGetRequestHandler.cpp OrthancServer/Sources/OrthancInitialization.cpp OrthancServer/Sources/OrthancMoveRequestHandler.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestArchive.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp OrthancServer/Sources/Search/HierarchicalMatcher.cpp OrthancServer/Sources/ServerContext.cpp OrthancServer/Sources/main.cpp |
| diffstat | 12 files changed, 72 insertions(+), 69 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancServer/Sources/OrthancConfiguration.cpp Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/OrthancConfiguration.cpp Mon Jul 06 16:33:25 2026 +0200 @@ -259,7 +259,7 @@ void OrthancConfiguration::LoadModalities() { - if (GetBooleanParameter(DICOM_MODALITIES_IN_DB, false)) + if (GetBooleanParameter(DICOM_MODALITIES_IN_DB)) { // Modalities are stored in the database if (serverIndex_ == NULL) @@ -347,7 +347,7 @@ void OrthancConfiguration::LoadPeers() { - if (GetBooleanParameter(ORTHANC_PEERS_IN_DB, false)) + if (GetBooleanParameter(ORTHANC_PEERS_IN_DB)) { // Peers are stored in the database if (serverIndex_ == NULL) @@ -417,7 +417,7 @@ void OrthancConfiguration::SaveModalities() { - if (GetBooleanParameter(DICOM_MODALITIES_IN_DB, false)) + if (GetBooleanParameter(DICOM_MODALITIES_IN_DB)) { // Modalities are stored in the database if (serverIndex_ == NULL) @@ -449,7 +449,7 @@ void OrthancConfiguration::SavePeers() { - if (GetBooleanParameter(ORTHANC_PEERS_IN_DB, false)) + if (GetBooleanParameter(ORTHANC_PEERS_IN_DB)) { // Peers are stored in the database if (serverIndex_ == NULL) @@ -628,17 +628,20 @@ } - bool OrthancConfiguration::GetBooleanParameter(const std::string& parameter, - bool defaultValue) const + bool OrthancConfiguration::GetBooleanParameter(const std::string& parameter) const { bool value; if (LookupBooleanParameter(value, parameter)) { return value; } + else if (defaultConfiguration.isMember(parameter) && defaultConfiguration[parameter].type() == Json::booleanValue) + { + return defaultConfiguration[parameter].asBool(); + } else { - return defaultValue; + throw OrthancException(ErrorCode_InternalError, std::string("No or invalid default parameter found in the default configuration for '") + parameter + "'"); } } @@ -868,7 +871,7 @@ bool OrthancConfiguration::IsSameAETitle(const std::string& aet1, const std::string& aet2) const { - if (GetBooleanParameter("StrictAetComparison", false)) + if (GetBooleanParameter("StrictAetComparison")) { // Case-sensitive matching return aet1 == aet2; @@ -927,7 +930,7 @@ << "\" is not listed in the \"DicomModalities\" configuration option"; return false; } - else if (!GetBooleanParameter("DicomCheckModalityHost", false) || + else if (!GetBooleanParameter("DicomCheckModalityHost") || ip == modality.GetHost()) { return true;
--- a/OrthancServer/Sources/OrthancConfiguration.h Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/OrthancConfiguration.h Mon Jul 06 16:33:25 2026 +0200 @@ -215,8 +215,7 @@ bool LookupBooleanParameter(bool& target, const std::string& parameter) const; - bool GetBooleanParameter(const std::string& parameter, - bool defaultValue) const; + bool GetBooleanParameter(const std::string& parameter) const; void GetDicomModalityUsingSymbolicName(RemoteModalityParameters& modality, const std::string& name) const; @@ -342,22 +341,22 @@ bool HasCheckRevisions() const { - return GetBooleanParameter(ORTHANC_CONFIG_CHECK_REVISIONS, false); + return GetBooleanParameter(ORTHANC_CONFIG_CHECK_REVISIONS); } bool HasStoreMD5ForAttachments() const { - return GetBooleanParameter(ORTHANC_CONFIG_STORE_MD5_FOR_ATTACHMENTS, true); + return GetBooleanParameter(ORTHANC_CONFIG_STORE_MD5_FOR_ATTACHMENTS); } bool HasStorageCompression() const { - return GetBooleanParameter(ORTHANC_CONFIG_STORAGE_COMPRESSION, false); + return GetBooleanParameter(ORTHANC_CONFIG_STORAGE_COMPRESSION); } bool HasPatientLevelEnabled() const { - return GetBooleanParameter(ORTHANC_CONFIG_PATIENT_LEVEL_ENABLED, true); + return GetBooleanParameter(ORTHANC_CONFIG_PATIENT_LEVEL_ENABLED); } static void DefaultExtractDicomSummary(DicomMap& target,
--- a/OrthancServer/Sources/OrthancFindRequestHandler.cpp Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/OrthancFindRequestHandler.cpp Mon Jul 06 16:33:25 2026 +0200 @@ -280,12 +280,12 @@ { OrthancConfiguration::ReaderLock lock; - caseSensitivePN = lock.GetConfiguration().GetBooleanParameter("CaseSensitivePN", false); + caseSensitivePN = lock.GetConfiguration().GetBooleanParameter("CaseSensitivePN"); RemoteModalityParameters remote; if (!lock.GetConfiguration().LookupDicomModalityUsingAETitle(remote, connection.GetRemoteAet())) { - if (lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowFind", false)) + if (lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowFind")) { CLOG(INFO, DICOM) << "C-FIND: Allowing SCU request from unknown modality with AET: " << connection.GetRemoteAet(); }
--- a/OrthancServer/Sources/OrthancGetRequestHandler.cpp Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/OrthancGetRequestHandler.cpp Mon Jul 06 16:33:25 2026 +0200 @@ -562,7 +562,7 @@ allowTranscoding_ = (context_.IsTranscodeDicomProtocol() && remote.IsTranscodingAllowed()); } - else if (lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowGet", false)) + else if (lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowGet")) { CLOG(INFO, DICOM) << "C-GET: Allowing SCU request from unknown modality with AET: " << originatorAet; allowTranscoding_ = context_.IsTranscodeDicomProtocol();
--- a/OrthancServer/Sources/OrthancInitialization.cpp Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/OrthancInitialization.cpp Mon Jul 06 16:33:25 2026 +0200 @@ -362,7 +362,7 @@ locale = lock.GetConfiguration().GetStringParameter(LOCALE, ""); } - bool loadPrivate = lock.GetConfiguration().GetBooleanParameter(LOAD_PRIVATE_DICTIONARY, true); + bool loadPrivate = lock.GetConfiguration().GetBooleanParameter(LOAD_PRIVATE_DICTIONARY); Orthanc::InitializeFramework(locale, loadPrivate); } @@ -533,9 +533,9 @@ LOG(WARNING) << "Storage directory: " << SystemToolbox::PathToUtf8(storageDirectory); // New in Orthanc 1.7.4 - bool fsyncOnWrite = lock.GetConfiguration().GetBooleanParameter(SYNC_STORAGE_AREA, true); + bool fsyncOnWrite = lock.GetConfiguration().GetBooleanParameter(SYNC_STORAGE_AREA); - if (lock.GetConfiguration().GetBooleanParameter(STORE_DICOM, true)) + if (lock.GetConfiguration().GetBooleanParameter(STORE_DICOM)) { return new PluginStorageAreaAdapter(new FilesystemStorage(storageDirectory, fsyncOnWrite)); }
--- a/OrthancServer/Sources/OrthancMoveRequestHandler.cpp Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/OrthancMoveRequestHandler.cpp Mon Jul 06 16:33:25 2026 +0200 @@ -327,7 +327,7 @@ { OrthancConfiguration::ReaderLock lock; - synchronous = lock.GetConfiguration().GetBooleanParameter("SynchronousCMove", true); + synchronous = lock.GetConfiguration().GetBooleanParameter("SynchronousCMove"); } if (synchronous)
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestArchive.cpp Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestArchive.cpp Mon Jul 06 16:33:25 2026 +0200 @@ -495,7 +495,7 @@ { OrthancConfiguration::ReaderLock lock; - streaming = lock.GetConfiguration().GetBooleanParameter("SynchronousZipStream", true); // New in Orthanc 1.9.4 + streaming = lock.GetConfiguration().GetBooleanParameter("SynchronousZipStream"); // New in Orthanc 1.9.4 } if (streaming) @@ -624,7 +624,7 @@ { OrthancConfiguration::ReaderLock lock; - defaultUtf8 = lock.GetConfiguration().GetBooleanParameter(CONFIG_ALLOW_UTF8, false); // New in Orthanc 1.12.11 + defaultUtf8 = lock.GetConfiguration().GetBooleanParameter(CONFIG_ALLOW_UTF8); // New in Orthanc 1.12.11 } bool synchronous, extended, transcode; @@ -826,7 +826,7 @@ { OrthancConfiguration::ReaderLock lock; - defaultUtf8 = lock.GetConfiguration().GetBooleanParameter(CONFIG_ALLOW_UTF8, false); // New in Orthanc 1.12.11 + defaultUtf8 = lock.GetConfiguration().GetBooleanParameter(CONFIG_ALLOW_UTF8); // New in Orthanc 1.12.11 } bool synchronous, extended, transcode;
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestModalities.cpp Mon Jul 06 16:33:25 2026 +0200 @@ -167,7 +167,7 @@ else { OrthancConfiguration::ReaderLock lock; - checkFind = lock.GetConfiguration().GetBooleanParameter("DicomEchoChecksFind", false); + checkFind = lock.GetConfiguration().GetBooleanParameter("DicomEchoChecksFind"); } ScuOperationFlags operations = ScuOperationFlags_Echo; @@ -1429,7 +1429,7 @@ { OrthancConfiguration::ReaderLock lock; - logExportedResources = lock.GetConfiguration().GetBooleanParameter("LogExportedResources", false); + logExportedResources = lock.GetConfiguration().GetBooleanParameter("LogExportedResources"); } for (Json::Value::ArrayIndex i = 0; i < resources->size(); i++)
--- a/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/OrthancRestApi/OrthancRestResources.cpp Mon Jul 06 16:33:25 2026 +0200 @@ -2702,7 +2702,7 @@ { OrthancConfiguration::ReaderLock lock; - if (lock.GetConfiguration().GetBooleanParameter("StoreDicom", true) && + if (lock.GetConfiguration().GetBooleanParameter("StoreDicom") && contentType == FileContentType_DicomAsJson) { allowed = true;
--- a/OrthancServer/Sources/Search/HierarchicalMatcher.cpp Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/Search/HierarchicalMatcher.cpp Mon Jul 06 16:33:25 2026 +0200 @@ -40,7 +40,7 @@ { OrthancConfiguration::ReaderLock lock; - caseSensitivePN = lock.GetConfiguration().GetBooleanParameter("CaseSensitivePN", false); + caseSensitivePN = lock.GetConfiguration().GetBooleanParameter("CaseSensitivePN"); } bool hasCodeExtensions;
--- a/OrthancServer/Sources/ServerContext.cpp Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/ServerContext.cpp Mon Jul 06 16:33:25 2026 +0200 @@ -421,14 +421,14 @@ defaultLocalAet_ = lock.GetConfiguration().GetOrthancAET(); jobsEngine_.SetWorkersCount(lock.GetConfiguration().GetUnsignedIntegerParameter("ConcurrentJobs")); - saveJobs_ = lock.GetConfiguration().GetBooleanParameter("SaveJobs", true); + saveJobs_ = lock.GetConfiguration().GetBooleanParameter("SaveJobs"); if (readOnly_ && saveJobs_) { LOG(WARNING) << "READ-ONLY SYSTEM: SaveJobs = true is incompatible with a ReadOnly system, ignoring this configuration"; saveJobs_ = false; } - metricsRegistry_->SetEnabled(lock.GetConfiguration().GetBooleanParameter("MetricsEnabled", true)); + metricsRegistry_->SetEnabled(lock.GetConfiguration().GetBooleanParameter("MetricsEnabled")); // New configuration options in Orthanc 1.5.1 findStorageAccessMode_ = StringToFindStorageAccessMode(lock.GetConfiguration().GetStringParameter("StorageAccessOnFind", "Always")); @@ -439,7 +439,7 @@ storageCommitmentReports_.reset(new StorageCommitmentReports(lock.GetConfiguration().GetUnsignedIntegerParameter("StorageCommitmentReportsSize"))); // New options in Orthanc 1.7.0 - transcodeDicomProtocol_ = lock.GetConfiguration().GetBooleanParameter("TranscodeDicomProtocol", true); + transcodeDicomProtocol_ = lock.GetConfiguration().GetBooleanParameter("TranscodeDicomProtocol"); std::string s; if (lock.GetConfiguration().LookupStringParameter(s, ORTHANC_CONFIG_INGEST_TRANSCODING)) @@ -451,8 +451,8 @@ << "transfer syntax: " << GetTransferSyntaxUid(ingestTransferSyntax_); // New options in Orthanc 1.8.2 - ingestTranscodingOfUncompressed_ = lock.GetConfiguration().GetBooleanParameter("IngestTranscodingOfUncompressed", true); - ingestTranscodingOfCompressed_ = lock.GetConfiguration().GetBooleanParameter("IngestTranscodingOfCompressed", true); + ingestTranscodingOfUncompressed_ = lock.GetConfiguration().GetBooleanParameter("IngestTranscodingOfUncompressed"); + ingestTranscodingOfCompressed_ = lock.GetConfiguration().GetBooleanParameter("IngestTranscodingOfCompressed"); LOG(WARNING) << " Ingest transcoding will " << (ingestTranscodingOfUncompressed_ ? "be applied" : "*not* be applied") @@ -475,7 +475,7 @@ } // New options in Orthanc 1.8.2 - if (lock.GetConfiguration().GetBooleanParameter("DeidentifyLogs", true)) + if (lock.GetConfiguration().GetBooleanParameter("DeidentifyLogs")) { deidentifyLogs_ = true; CLOG(INFO, DICOM) << "Deidentification of log contents (notably for DIMSE queries) is enabled"; @@ -506,7 +506,7 @@ lock.GetConfiguration().GetAcceptedTransferSyntaxes(acceptedTransferSyntaxes_); - isUnknownSopClassAccepted_ = lock.GetConfiguration().GetBooleanParameter("UnknownSopClassAccepted", false); + isUnknownSopClassAccepted_ = lock.GetConfiguration().GetBooleanParameter("UnknownSopClassAccepted"); // New options in Orthanc 1.12.6 std::list<std::string> acceptedSopClasses;
--- a/OrthancServer/Sources/main.cpp Mon Jul 06 16:14:09 2026 +0200 +++ b/OrthancServer/Sources/main.cpp Mon Jul 06 16:33:25 2026 +0200 @@ -300,12 +300,12 @@ { { OrthancConfiguration::ReaderLock lock; - alwaysAllowEcho_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowEcho", true); - alwaysAllowFind_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowFind", false); - alwaysAllowFindWorklist_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowFindWorklist", false); - alwaysAllowGet_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowGet", false); - alwaysAllowMove_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowMove", false); - alwaysAllowStore_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowStore", true); + alwaysAllowEcho_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowEcho"); + alwaysAllowFind_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowFind"); + alwaysAllowFindWorklist_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowFindWorklist"); + alwaysAllowGet_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowGet"); + alwaysAllowMove_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowMove"); + alwaysAllowStore_ = lock.GetConfiguration().GetBooleanParameter("DicomAlwaysAllowStore"); } if (alwaysAllowFind_) @@ -415,7 +415,7 @@ { OrthancConfiguration::ReaderLock lock; lock.GetConfiguration().LookupDicomModalitiesUsingAETitle(modalities, remoteAet); - checkIp = lock.GetConfiguration().GetBooleanParameter("DicomCheckModalityHost", false); + checkIp = lock.GetConfiguration().GetBooleanParameter("DicomCheckModalityHost"); } if (modalities.empty()) @@ -1086,7 +1086,7 @@ { OrthancConfiguration::ReaderLock lock; - httpServerEnabled = lock.GetConfiguration().GetBooleanParameter("HttpServerEnabled", true); + httpServerEnabled = lock.GetConfiguration().GetBooleanParameter("HttpServerEnabled"); } if (!httpServerEnabled) @@ -1101,9 +1101,9 @@ bool httpDescribeErrors; #if ORTHANC_ENABLE_MONGOOSE == 1 - const bool defaultKeepAlive = false; + bool keepAlive = false; #elif ORTHANC_ENABLE_CIVETWEB == 1 - const bool defaultKeepAlive = true; + bool keepAlive = true; #else # error "Either Mongoose or Civetweb must be enabled to compile this file" #endif @@ -1113,7 +1113,7 @@ { OrthancConfiguration::ReaderLock lock; - httpDescribeErrors = lock.GetConfiguration().GetBooleanParameter("HttpDescribeErrors", true); + httpDescribeErrors = lock.GetConfiguration().GetBooleanParameter("HttpDescribeErrors"); // HTTP server httpServer.SetThreadsCount(lock.GetConfiguration().GetUnsignedIntegerParameter("HttpThreadsCount")); @@ -1121,11 +1121,13 @@ std::set<std::string> httpBindAddresses; lock.GetConfiguration().GetSetOfStringsParameter(httpBindAddresses, "HttpBindAddresses"); httpServer.SetBindAddresses(httpBindAddresses); - httpServer.SetRemoteAccessAllowed(lock.GetConfiguration().GetBooleanParameter("RemoteAccessAllowed", false)); - httpServer.SetKeepAliveEnabled(lock.GetConfiguration().GetBooleanParameter("KeepAlive", defaultKeepAlive)); + httpServer.SetRemoteAccessAllowed(lock.GetConfiguration().GetBooleanParameter("RemoteAccessAllowed")); + + lock.GetConfiguration().LookupBooleanParameter(keepAlive, "KeepAlive"); // we cannot use GetBooleanParameter because the default value depends on the HttpServer lib that is used + httpServer.SetKeepAliveEnabled(keepAlive); httpServer.SetKeepAliveTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("KeepAliveTimeout")); - httpServer.SetHttpCompressionEnabled(lock.GetConfiguration().GetBooleanParameter("HttpCompressionEnabled", false)); - httpServer.SetTcpNoDelay(lock.GetConfiguration().GetBooleanParameter("TcpNoDelay", true)); + httpServer.SetHttpCompressionEnabled(lock.GetConfiguration().GetBooleanParameter("HttpCompressionEnabled")); + httpServer.SetTcpNoDelay(lock.GetConfiguration().GetBooleanParameter("TcpNoDelay")); httpServer.SetRequestTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("HttpRequestTimeout")); // New in Orthanc 1.12.11 @@ -1222,7 +1224,7 @@ } } - if (lock.GetConfiguration().GetBooleanParameter("SslEnabled", false)) + if (lock.GetConfiguration().GetBooleanParameter("SslEnabled")) { boost::filesystem::path certificate = lock.GetConfiguration().InterpretStringParameterAsPath( lock.GetConfiguration().GetStringParameter("SslCertificate", "certificate.pem")); @@ -1270,7 +1272,7 @@ httpServer.SetSslEnabled(false); } - if (lock.GetConfiguration().GetBooleanParameter("SslVerifyPeers", false)) + if (lock.GetConfiguration().GetBooleanParameter("SslVerifyPeers")) { boost::filesystem::path trustedClientCertificates = lock.GetConfiguration().InterpretStringParameterAsPath( lock.GetConfiguration().GetStringParameter("SslTrustedClientCertificates", "trustedCertificates.pem")); @@ -1284,7 +1286,7 @@ LOG(INFO) << "Version of Lua: " << LUA_VERSION; - if (lock.GetConfiguration().GetBooleanParameter("ExecuteLuaEnabled", false)) + if (lock.GetConfiguration().GetBooleanParameter("ExecuteLuaEnabled")) { context.SetExecuteLuaEnabled(true); LOG(WARNING) << "====> Remote LUA script execution is enabled. Review your configuration option \"ExecuteLuaEnabled\". " @@ -1296,7 +1298,7 @@ LOG(WARNING) << "Remote LUA script execution is disabled"; } - if (lock.GetConfiguration().GetBooleanParameter("RestApiWriteToFileSystemEnabled", false)) + if (lock.GetConfiguration().GetBooleanParameter("RestApiWriteToFileSystemEnabled")) { context.SetRestApiWriteToFileSystemEnabled(true); LOG(WARNING) << "====> Your REST API can write to the FileSystem. Review your configuration option \"RestApiWriteToFileSystemEnabled\". " @@ -1308,10 +1310,10 @@ LOG(WARNING) << "REST API cannot write to the file system because the \"RestApiWriteToFileSystemEnabled\" configuration is set to false. The URI /instances/../export is disabled. This is the most secure configuration."; } - if (lock.GetConfiguration().GetBooleanParameter("WebDavEnabled", true)) + if (lock.GetConfiguration().GetBooleanParameter("WebDavEnabled")) { - const bool allowDelete = lock.GetConfiguration().GetBooleanParameter("WebDavDeleteAllowed", false); - const bool allowUpload = lock.GetConfiguration().GetBooleanParameter("WebDavUploadAllowed", true); + const bool allowDelete = lock.GetConfiguration().GetBooleanParameter("WebDavDeleteAllowed"); + const bool allowUpload = lock.GetConfiguration().GetBooleanParameter("WebDavUploadAllowed"); UriComponents root; root.push_back("webdav"); @@ -1364,7 +1366,7 @@ { OrthancConfiguration::ReaderLock lock; - dicomServerEnabled = lock.GetConfiguration().GetBooleanParameter("DicomServerEnabled", true); + dicomServerEnabled = lock.GetConfiguration().GetBooleanParameter("DicomServerEnabled"); } if (!dicomServerEnabled) @@ -1390,14 +1392,14 @@ { OrthancConfiguration::ReaderLock lock; - dicomServer.SetCalledApplicationEntityTitleCheck(lock.GetConfiguration().GetBooleanParameter("DicomCheckCalledAet", false)); + dicomServer.SetCalledApplicationEntityTitleCheck(lock.GetConfiguration().GetBooleanParameter("DicomCheckCalledAet")); dicomServer.SetAssociationTimeout(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomScpTimeout")); dicomServer.SetPortNumber(lock.GetConfiguration().GetDicomPort()); dicomServer.SetThreadsCount(lock.GetConfiguration().GetUnsignedIntegerParameter("DicomThreadsCount")); dicomServer.SetApplicationEntityTitle(lock.GetConfiguration().GetOrthancAET()); // Configuration of DICOM TLS for Orthanc SCP (since Orthanc 1.9.0) - dicomServer.SetDicomTlsEnabled(lock.GetConfiguration().GetBooleanParameter(KEY_DICOM_TLS_ENABLED, false)); + dicomServer.SetDicomTlsEnabled(lock.GetConfiguration().GetBooleanParameter(KEY_DICOM_TLS_ENABLED)); if (dicomServer.IsDicomTlsEnabled()) { dicomServer.SetOwnCertificatePath( @@ -1417,7 +1419,7 @@ // New option in Orthanc 1.9.3 dicomServer.SetRemoteCertificateRequired( - lock.GetConfiguration().GetBooleanParameter(KEY_DICOM_TLS_REMOTE_CERTIFICATE_REQUIRED, true)); + lock.GetConfiguration().GetBooleanParameter(KEY_DICOM_TLS_REMOTE_CERTIFICATE_REQUIRED)); } #if ORTHANC_ENABLE_PLUGINS == 1 @@ -1505,8 +1507,7 @@ bool orthancExplorerEnabled = false; { OrthancConfiguration::ReaderLock lock; - orthancExplorerEnabled = lock.GetConfiguration().GetBooleanParameter( - "OrthancExplorerEnabled", true); + orthancExplorerEnabled = lock.GetConfiguration().GetBooleanParameter("OrthancExplorerEnabled"); } if (orthancExplorerEnabled) @@ -1666,9 +1667,9 @@ httpsCaCertificates = lock.GetConfiguration().InterpretStringParameterAsPath(httpsCaCertificatesStr); } - HttpClient::ConfigureSsl(lock.GetConfiguration().GetBooleanParameter("HttpsVerifyPeers", true), + HttpClient::ConfigureSsl(lock.GetConfiguration().GetBooleanParameter("HttpsVerifyPeers"), httpsCaCertificates); - HttpClient::SetDefaultVerbose(lock.GetConfiguration().GetBooleanParameter("HttpVerbose", false)); + HttpClient::SetDefaultVerbose(lock.GetConfiguration().GetBooleanParameter("HttpVerbose")); // The value "0" below makes the class HttpClient use its default // value (DEFAULT_HTTP_TIMEOUT = 60 seconds in Orthanc 1.5.7) @@ -1686,7 +1687,7 @@ } // New option in Orthanc 1.12.5 - readOnly = lock.GetConfiguration().GetBooleanParameter(ORTHANC_CONFIG_READ_ONLY, false); + readOnly = lock.GetConfiguration().GetBooleanParameter(ORTHANC_CONFIG_READ_ONLY); // New option in Orthanc 1.12.6 maxDcmtkConcurrentTranscoders = lock.GetConfiguration().GetUnsignedIntegerParameter(KEY_MAXIMUM_CONCURRENT_DCMTK_TRANSCODERS); @@ -1706,7 +1707,7 @@ // New option in Orthanc 1.9.3 DicomAssociationParameters::SetDefaultRemoteCertificateRequired( - lock.GetConfiguration().GetBooleanParameter(KEY_DICOM_TLS_REMOTE_CERTIFICATE_REQUIRED, true)); + lock.GetConfiguration().GetBooleanParameter(KEY_DICOM_TLS_REMOTE_CERTIFICATE_REQUIRED)); } ServerContext context(database, storageArea, false /* not running unit tests */, maxCompletedJobs, readOnly); @@ -1743,7 +1744,7 @@ } else if (lock.GetJson()[ORTHANC_CONFIG_OVERWRITE_INSTANCES].isBool()) { - bool overwriteInstancesLegacy = lock.GetConfiguration().GetBooleanParameter(ORTHANC_CONFIG_OVERWRITE_INSTANCES, false); + bool overwriteInstancesLegacy = lock.GetJson()[ORTHANC_CONFIG_OVERWRITE_INSTANCES].asBool(); overwriteInstancesMode = (overwriteInstancesLegacy ? OverwriteInstancesMode_Always : OverwriteInstancesMode_Never); } }
