Configuring the S3 plugin with environment variables

Hey all,

I’m using a container derived from the Osimis container. This should allow me to configure orthanc using environment variables. I am able to successfully configure the Postgresql plugin via environment variables. However, the S3 plugin does not seem to pick up my config values. These are the lines I’m using :

export ORTHANC__POSTGRESQL__HOST=“VALUE”
export ORTHANC__POSTGRESQL__PASSWORD=“VALUE”
export ORTHANC__POSTGRESQL__ENABLE_SSL=“VALUE”

export ORTHANC__AWS_S3_STORAGE__BUCKET_NAME=“VALUE”
export ORTHANC__AWS_S3_STORAGE__REGION=“VALUE”
export ORTHANC__AWS_S3_STORAGE__ACCESS_KEY=“VALUE”
export ORTHANC__AWS_S3_STORAGE__SECRET_KEY=“VALUE”

Am I doing it wrong?

As an experiment, I set VERBOSE_STARTUP=true, and the generated configuration file does contain my AWS_S3_STORAGE configuration values. It just seems like the S3 plugin is not picking them up.

Are you sure that your plugin is loaded/started ? It should be stored in /usr/share/orthanc/plugins/.

The plugin works fine if we put the configuration in orthanc.json. So I’m assuming all is well with the plugin. The problem happens when I try to set the config values through environment variables. To help with debugging, I’ve attached the output Orthanc gives me when I try to start it.

orthanc_out.txt (20.6 KB)

Also, minor correction : I just noticed that the environment variable config isn’t working for the postgresql plugin either. It appears that for both plugins, the environment variables are being ignored.

Does environment variable config work for plugins?

How are you running the container, by docker run or docker-compose? From the look of it, you’re setting the environmental variables in your terminal before running the container. If so, these won’t be picked up by your container. Here is an example of how to set the appropriate variables using docker-compose https://bitbucket.org/osimis/orthanc-setup-samples/src/master/docker/postgresql/docker-compose.yml

James

Orthanc is not reading the configuration file that is generated by the startup script but is reading another file. Have you changed the startup command ?

image.png

That’s a great observation!

So, I have created a customized version of /docker-entrypoint.sh . However, I only made one change : I took out the lines that prevent you from passing more than one argument to the script. I needed to do this so I could pass the --logdir argument to orthanc.

This is how I call the script at the end of my entrypoint.sh :

cp ./orthanc_config_with_my_custom_settings.json /etc/orthanc/orthanc.json
/my-docker-entrypoint.sh --logdir=/var/log/orthanc/ /etc/orthanc/

However, when I change the call to this, it picks up my environment variables and everything works :
cp ./orthanc_config_with_my_custom_settings.json /etc/orthanc/orthanc.json

/my-docker-entrypoint.sh --logdir=/var/log/orthanc/ /tmp/orthanc.json

Is it bad to provide /tmp/orthanc.json as the location for the config file? And if it is bad to provide /tmp/orthanc.json, why does it fail when I provide /etc/orthanc/ as the location?