At application launch, after creating a new Store object with the schema as a parameter, the object is not immediately persisted to the config file. Is this expected behavior? It creates a disconnect between the store object and the file.
const _store = new Store({ schema });
Afterwords, if I explicitly set any key/value pair:
_store.set('key', 'value');
the library seems to write out the aforementioned schema defaults to the file, along with whatever I explicitly set. I've not configured the config.json file at all, it uses default name and Windows location. I can't find any functions that mention explicitly writing out to the config file in the docs. It does however say: "Changes are written to disk atomically, so if the process crashes during a write, it will not corrupt the existing config."
The problem I'm trying to solve is validation of config values on startup. If my config file is empty at startup, My validation is matching against the new Store object default values in memory, instead of the empty values in my file. I could fix this by explicitly looking through the file but I assume that's not the intended approach. Maybe new Store()
is not appropriate in this situation?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too