You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've experienced a few instances of configuration issues where the JSON configuration file has been modified and the code has been modified to use the new config, but I haven't got the memo and have encountered runtime problems that have sometimes been mysterious. e.g. #194
The problem is that the configuration file contains localised values including secrets, so it isn't under version control, which means changes to the file's schema need to be communicated "out of band", which is a hassle and error-prone (easy to forget).
I've had some thoughts about how we could mitigate the risk of issues like this re-occurring in future.
One improvement could be to strengthen the code which directly accesses sub-properties of the configuration object loaded from the JSON file, so that it's wrapped in a function that logs any errors e.g. replace
Another possibility, which would be even easier to implement, would be to have some kind of on-boot validation of the configuration file that would log a warning about any discrepancy between the config file that's in effect, and the dummy 'example' version of the file which is under version control. If the two files had any differences in their structure (i.e. the sets of property names), that would be easy to detect with a simple recursive descent of the two objects in parallel, and that would catch most changes. Would that work? Or does the configuration actually have optional components, that might legitimately vary between the example configuration file and the local configuration?
I had a look at JSON schema support in Node and there are packages that certainly seem easy to use, once you have a schema for your JSON document, but maintaining a JSON schema for the configuration file seems like a lot of work when we're really only interested in the simplest kind of validation, which I think a simple comparison with an "example" configuration would provide.
The text was updated successfully, but these errors were encountered:
This file: https://github.com/CoEDL/nyingarn-workspace/blob/master/configuration/example-configuration.json is always up to date with whatever changes I make to the configuration when I make them. That should be the first place you look if something is screwy. Or email me. There's only two of us so we should be able to make this work without adding a layer of stuff into the API. Especially since this isn't happening constantly.
I'll aim to do better at keeping you up to date with changes.
I've experienced a few instances of configuration issues where the JSON configuration file has been modified and the code has been modified to use the new config, but I haven't got the memo and have encountered runtime problems that have sometimes been mysterious. e.g. #194
The problem is that the configuration file contains localised values including secrets, so it isn't under version control, which means changes to the file's schema need to be communicated "out of band", which is a hassle and error-prone (easy to forget).
I've had some thoughts about how we could mitigate the risk of issues like this re-occurring in future.
One improvement could be to strengthen the code which directly accesses sub-properties of the
configuration
object loaded from the JSON file, so that it's wrapped in a function that logs any errors e.g. replacewith
Another possibility, which would be even easier to implement, would be to have some kind of on-boot validation of the configuration file that would log a warning about any discrepancy between the config file that's in effect, and the dummy 'example' version of the file which is under version control. If the two files had any differences in their structure (i.e. the sets of property names), that would be easy to detect with a simple recursive descent of the two objects in parallel, and that would catch most changes. Would that work? Or does the configuration actually have optional components, that might legitimately vary between the example configuration file and the local configuration?
I had a look at JSON schema support in Node and there are packages that certainly seem easy to use, once you have a schema for your JSON document, but maintaining a JSON schema for the configuration file seems like a lot of work when we're really only interested in the simplest kind of validation, which I think a simple comparison with an "example" configuration would provide.
The text was updated successfully, but these errors were encountered: