Mercurial > hg > orthanc
diff OrthancServer/main.cpp @ 810:401a9633e492
configuration into a namespace
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 07 May 2014 16:47:56 +0200 |
parents | 4e3593c3511d |
children | a811bdf8b8eb |
line wrap: on
line diff
--- a/OrthancServer/main.cpp Wed May 07 16:39:53 2014 +0200 +++ b/OrthancServer/main.cpp Wed May 07 16:47:56 2014 +0200 @@ -130,7 +130,7 @@ return true; } - if (!IsKnownAETitle(callingAet)) + if (!Configuration::IsKnownAETitle(callingAet)) { LOG(ERROR) << "Unknown remote DICOM modality AET: \"" << callingAet << "\""; return false; @@ -324,24 +324,24 @@ OrthancInitialize(); } - std::string storageDirectoryStr = GetGlobalStringParameter("StorageDirectory", "OrthancStorage"); - boost::filesystem::path storageDirectory = InterpretStringParameterAsPath(storageDirectoryStr); - boost::filesystem::path indexDirectory = - InterpretStringParameterAsPath(GetGlobalStringParameter("IndexDirectory", storageDirectoryStr)); + std::string storageDirectoryStr = Configuration::GetGlobalStringParameter("StorageDirectory", "OrthancStorage"); + boost::filesystem::path storageDirectory = Configuration::InterpretStringParameterAsPath(storageDirectoryStr); + boost::filesystem::path indexDirectory = Configuration::InterpretStringParameterAsPath( + Configuration::GetGlobalStringParameter("IndexDirectory", storageDirectoryStr)); ServerContext context(storageDirectory, indexDirectory); LOG(WARNING) << "Storage directory: " << storageDirectory; LOG(WARNING) << "Index directory: " << indexDirectory; - context.SetCompressionEnabled(GetGlobalBoolParameter("StorageCompression", false)); - context.SetStoreMD5ForAttachments(GetGlobalBoolParameter("StoreMD5ForAttachments", true)); + context.SetCompressionEnabled(Configuration::GetGlobalBoolParameter("StorageCompression", false)); + context.SetStoreMD5ForAttachments(Configuration::GetGlobalBoolParameter("StoreMD5ForAttachments", true)); std::list<std::string> luaScripts; - GetGlobalListOfStringsParameter(luaScripts, "LuaScripts"); + Configuration::GetGlobalListOfStringsParameter(luaScripts, "LuaScripts"); for (std::list<std::string>::const_iterator it = luaScripts.begin(); it != luaScripts.end(); ++it) { - std::string path = InterpretStringParameterAsPath(*it); + std::string path = Configuration::InterpretStringParameterAsPath(*it); LOG(WARNING) << "Installing the Lua scripts from: " << path; std::string script; Toolbox::ReadFile(script, path); @@ -351,7 +351,7 @@ try { - context.GetIndex().SetMaximumPatientCount(GetGlobalIntegerParameter("MaximumPatientCount", 0)); + context.GetIndex().SetMaximumPatientCount(Configuration::GetGlobalIntegerParameter("MaximumPatientCount", 0)); } catch (...) { @@ -360,7 +360,7 @@ try { - uint64_t size = GetGlobalIntegerParameter("MaximumStorageSize", 0); + uint64_t size = Configuration::GetGlobalIntegerParameter("MaximumStorageSize", 0); context.GetIndex().SetMaximumStorageSize(size * 1024 * 1024); } catch (...) @@ -374,28 +374,28 @@ // DICOM server DicomServer dicomServer; OrthancApplicationEntityFilter dicomFilter; - dicomServer.SetCalledApplicationEntityTitleCheck(GetGlobalBoolParameter("DicomCheckCalledAet", false)); + dicomServer.SetCalledApplicationEntityTitleCheck(Configuration::GetGlobalBoolParameter("DicomCheckCalledAet", false)); dicomServer.SetStoreRequestHandlerFactory(serverFactory); dicomServer.SetMoveRequestHandlerFactory(serverFactory); dicomServer.SetFindRequestHandlerFactory(serverFactory); - dicomServer.SetPortNumber(GetGlobalIntegerParameter("DicomPort", 4242)); - dicomServer.SetApplicationEntityTitle(GetGlobalStringParameter("DicomAet", "ORTHANC")); + dicomServer.SetPortNumber(Configuration::GetGlobalIntegerParameter("DicomPort", 4242)); + dicomServer.SetApplicationEntityTitle(Configuration::GetGlobalStringParameter("DicomAet", "ORTHANC")); dicomServer.SetApplicationEntityFilter(dicomFilter); // HTTP server MyIncomingHttpRequestFilter httpFilter(context); MongooseServer httpServer; - httpServer.SetPortNumber(GetGlobalIntegerParameter("HttpPort", 8042)); - httpServer.SetRemoteAccessAllowed(GetGlobalBoolParameter("RemoteAccessAllowed", false)); + httpServer.SetPortNumber(Configuration::GetGlobalIntegerParameter("HttpPort", 8042)); + httpServer.SetRemoteAccessAllowed(Configuration::GetGlobalBoolParameter("RemoteAccessAllowed", false)); httpServer.SetIncomingHttpRequestFilter(httpFilter); - httpServer.SetAuthenticationEnabled(GetGlobalBoolParameter("AuthenticationEnabled", false)); - SetupRegisteredUsers(httpServer); + httpServer.SetAuthenticationEnabled(Configuration::GetGlobalBoolParameter("AuthenticationEnabled", false)); + Configuration::SetupRegisteredUsers(httpServer); - if (GetGlobalBoolParameter("SslEnabled", false)) + if (Configuration::GetGlobalBoolParameter("SslEnabled", false)) { - std::string certificate = - InterpretStringParameterAsPath(GetGlobalStringParameter("SslCertificate", "certificate.pem")); + std::string certificate = Configuration::InterpretStringParameterAsPath( + Configuration::GetGlobalStringParameter("SslCertificate", "certificate.pem")); httpServer.SetSslEnabled(true); httpServer.SetSslCertificate(certificate.c_str()); } @@ -413,7 +413,7 @@ httpServer.RegisterHandler(new OrthancRestApi(context)); // GO !!! Start the requested servers - if (GetGlobalBoolParameter("HttpServerEnabled", true)) + if (Configuration::GetGlobalBoolParameter("HttpServerEnabled", true)) { httpServer.Start(); LOG(WARNING) << "HTTP server listening on port: " << httpServer.GetPortNumber(); @@ -423,7 +423,7 @@ LOG(WARNING) << "The HTTP server is disabled"; } - if (GetGlobalBoolParameter("DicomServerEnabled", true)) + if (Configuration::GetGlobalBoolParameter("DicomServerEnabled", true)) { dicomServer.Start(); LOG(WARNING) << "DICOM server listening on port: " << dicomServer.GetPortNumber();