I have an application (app A) which over the years has acquired lots of settings. These are saved in a json file but exist in an application variable for easy access. When a setting is changed, the file is re-saved and the variable is updated. So far, so good.
Now I’ve created a new ‘sub-application’ (app B) in a sub-directory of the main application with the idea that it is a simple little thing which has only one task, is completely isolated from app A, and consumes settings read-only.
When App B initializes, it loads the settings from file, same as app A does, but of course - and this is what I didn’t think of - if a setting is changed by app A, app A knows about it straight away, but of course app B doesn’t, until it expires and re-initializes…
I can think of a variety of ways app A could tell app B to reload its settings - a webhook, or a hash of the json file read every request by app B, or something, but they all seem a bit clunky.
The ideal would be to have one lot of settings in memory accessible by both applications, app A is read-write, app B only reads them.
Can this be done, somehow?