# HG changeset patch # User Sebastien Jodogne # Date 1541592419 -3600 # Node ID 40131f0c25b52b799d71adad1fc0587c1d9a8420 # Parent 0a4428aad5126e5df058e437b0ff7ebb51456082 Orthanc configuration file can use environment variables diff -r 0a4428aad512 -r 40131f0c25b5 NEWS --- a/NEWS Wed Nov 07 12:59:03 2018 +0100 +++ b/NEWS Wed Nov 07 13:06:59 2018 +0100 @@ -6,6 +6,7 @@ ------- * Possibility to restrict the allowed DICOM commands for each modality +* The Orthanc configuration file can use environment variables Orthanc Explorer ---------------- diff -r 0a4428aad512 -r 40131f0c25b5 OrthancServer/OrthancInitialization.cpp --- a/OrthancServer/OrthancInitialization.cpp Wed Nov 07 12:59:03 2018 +0100 +++ b/OrthancServer/OrthancInitialization.cpp Wed Nov 07 13:06:59 2018 +0100 @@ -118,6 +118,9 @@ static void AddFileToConfiguration(Json::Value& target, const boost::filesystem::path& path) { + std::map env; + SystemToolbox::GetEnvironmentVariables(env); + LOG(WARNING) << "Reading the configuration from: " << path; Json::Value config; @@ -126,6 +129,8 @@ std::string content; SystemToolbox::ReadFile(content, path.string()); + content = Toolbox::SubstituteVariables(content, env); + Json::Value tmp; Json::Reader reader; if (!reader.parse(content, tmp) || @@ -144,6 +149,7 @@ } else { + // Merge the newly-added file with the previous content of "target" Json::Value::Members members = config.getMemberNames(); for (Json::Value::ArrayIndex i = 0; i < members.size(); i++) {