SORMAS-Docker icon indicating copy to clipboard operation
SORMAS-Docker copied to clipboard

Avoid the sed facade in start-server.sh by mounting the sormas.properties file directly into the sormas container

Open JonasCir opened this issue 4 years ago • 1 comments

Situation

For each new property, we have to adjust the .env file, and need to add sed calls to the start-server.sh script. This introduces a lot of dependencies and margin for errors. I just noticed that for S2S the are variables in the environment which are not even used.

How to improve

Provide an example sormas.properties which gets mounted into the sormas containers. If new properties are introduced, we then just need to touch one central file and avoid inconsistencies between the files in this repo and upstream SORMAS. Further, this will save us directly >200 LOC of setup code as well as in the compose files which do not need to forward every single env variable on their own.

Another advantage for production is, that you only need to template the properties file directly without the need to take a complicated detour over .env and the setup script.

JonasCir avatar Jul 14 '21 11:07 JonasCir

Further, some characters like - confuse sed, so you can't really use them: sed -i -E "s/#?sormas2sormas.id=.*/sormas2sormas.id=${SORMAS2SORMAS_ID}/" "${PROPERTIES_FILE}" wont work for SORMAS2SORMAS_ID=HZI-TEST. >ou have to take care of escaping manually or via scripts while populating the env which is just a pain.

JonasCir avatar Jul 15 '21 09:07 JonasCir