diff OrthancServer/Sources/main.cpp @ 4378:9e2fc6911ac8 varian

adding option to disable orthance explorer when http server is enabled
author Andrew Wallis <andrew.wallis@varian.com>>
date Fri, 11 Dec 2020 14:57:31 -0500
parents 3dffe8f7af48
children df313e410f0c
line wrap: on
line diff
--- a/OrthancServer/Sources/main.cpp	Thu Dec 17 11:27:37 2020 +0100
+++ b/OrthancServer/Sources/main.cpp	Fri Dec 11 14:57:31 2020 -0500
@@ -1229,10 +1229,25 @@
   FilesystemHttpHandler staticResources("/app", ORTHANC_PATH "/OrthancExplorer");
 #endif
 
-  context.GetHttpHandler().Register(staticResources, false);
+  // Do not register static resources if orthanc explorer is disabled
+  bool orthancExplorerEnabled = false;
+  {
+    OrthancConfiguration::ReaderLock lock;
+    orthancExplorerEnabled = lock.GetConfiguration().GetBooleanParameter(
+        "OrthancExplorerEnabled", true);
+  }
+
+  if (orthancExplorerEnabled)
+  {
+    context.GetHttpHandler().Register(staticResources, false);
+  }
+  else
+  {
+    LOG(WARNING) << "Orthanc Explorer UI is disabled";
+  }
 
   // Thirdly, consider the built-in REST API of Orthanc
-  OrthancRestApi restApi(context);
+  OrthancRestApi restApi(context, orthancExplorerEnabled);
   context.GetHttpHandler().Register(restApi, true);
 
   context.SetupJobsEngine(false /* not running unit tests */, loadJobsFromDatabase);