Good after noon all - I hope everyone is enjoying their weekend …
Does anyone know if there’s a way of re-reading a credentials file without restarting Orthanc (and therefore everything else it’s doing)? I keep my credentials in a separate file so that no-one need to touch the main config file, however when I need to update those credentials, I have to restart the Orthanc server completely.
I appreciate that everything gets loaded up into memory once the server starts, but I do wonder if there’s a way of having Orthanc check the hash of a creds file and then, if it differs from the one it’s currently holding in memory, would reload the creds file, replacing it’s contents with the content it currently holds. That will allow dynamic updating of credentials without restarting the entire server.
My thought process is:
- orthanc.json would have a couple of entries in it’s config file “CredentialsFile” : “cred.json”, “CredentialsFileRead” : “300” denoting the file containing the credentials and the time, in seconds between each re-read of the file
- When Orthanc starts up, it calculates the hash of the CredentialsFile and stores the hash in memory
- After CredentialsFileRead seconds, Orthanc calculates the hash of the cred file and compares it with what’s in memory.
- If the hash is the same, it waits another (300) seconds.
- If the hash is different, it re-reads the creds file and then replaces what’s currently in memory with the contents of the updated file
- Wait another (300) seconds
I appreciate that there’s going to be a balance between the cycles it takes re-reading the file versus calculating the hash, so perhaps there’s a better way of checking the file (maybe the modified timestamp of the file itself would be enough?)
If this could happen, then it could also apply to re-reading other security related fiels, such as the combined client TLS certificates file - same thing applies really.
Thoughts?