Mercurial > hg > orthanc
changeset 2922:40131f0c25b5
Orthanc configuration file can use environment variables
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 07 Nov 2018 13:06:59 +0100 |
parents | 0a4428aad512 |
children | 87366b8aed4f |
files | NEWS OrthancServer/OrthancInitialization.cpp |
diffstat | 2 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 ----------------
--- 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<std::string, std::string> 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++) {