# HG changeset patch # User Sebastien Jodogne # Date 1619696558 -7200 # Node ID 7fbe9147423f3351c09e6dd5b6c525bfd87b82d3 # Parent fcb215df05cbeb1a24bae62b874757cebcbdc0b5 environment variables diff -r fcb215df05cb -r 7fbe9147423f Sphinx/source/users/configuration.rst --- a/Sphinx/source/users/configuration.rst Thu Apr 29 13:07:59 2021 +0200 +++ b/Sphinx/source/users/configuration.rst Thu Apr 29 13:42:38 2021 +0200 @@ -1,9 +1,10 @@ .. _configuration: -.. highlight:: bash Configuration of Orthanc ======================== +.. highlight:: bash + Configuring Orthanc simply consists in providing a configuration file. Orthanc has numerous configuration that are documented in the `default configuration file @@ -20,6 +21,8 @@ * Create a HTTP server for the REST API that listens on the port 8042. * Store the Orthanc database in a folder called ``OrthancStorage``. +.. highlight:: json + However, we recommend that you start from an empty configuration file and only specify the options for which you don't wan't to use the default value. In example, a simple configuration file would be:: @@ -37,6 +40,8 @@ one file per plugin. This is how the configuration files are provided with the Windows Installer. +.. highlight:: bash + Once your configuration file is ready, start Orthanc by giving it the path to the configuration file path as a command-line argument. If you use multiple configuration files, you may provide the path to the folder containing all configuration files @@ -75,3 +80,53 @@ To learn more about the Orthanc logs, :ref:`check out the dedicated page `. + + +Environment variables +--------------------- + +.. highlight:: json + +Starting with Orthanc 1.5.0, the configuration file can include the +value of environment variables. Consider the following configuration:: + + { + "Name" : "${ORTHANC_NAME}" + } + + +.. highlight:: bash + +In this case, once Orthanc starts, the configuration option ``Name`` +will be read from the value of the environment variable +``ORTHANC_NAME``. For instance:: + + $ ORTHANC_NAME=Hello ./Orthanc Configuration.json + $ curl http://localhost:8042/system + { + "Name" : "Hello", + [...] + } + + +.. highlight:: json + +It is also possible to set a default value if the environment variable +is not set. Here is the syntax in the configuration file:: + + { + "Name" : "${ORTHANC_NAME:-DefaultName}" + } + + +.. highlight:: bash + +If the environment variable ``ORTHANC_NAME`` is not set, here is the +result:: + + $ ./Orthanc Configuration2.json + $ curl http://localhost:8042/system + { + "Name" : "DefaultName", + [...] + }