Split .config.json into separate files #2704
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposed changes
The runtime settings are currently stored in
~/.node-red/.config.json
. This contains:_credentialSecret
.Putting all of these things in one place is not ideal - a consequence of the Storage API only having a simple read/write API for the whole settings object.
This PR changes the default LocalFileSystem storage plugin to split the settings into 4 files:
.config.nodes.json
- the node registry.config.users.json
- user specific settings (eg editor settings).config.projects.json
- project settings, including the active project.config.runtime.json
- everything else - most notable _credentialSecretThis reduces the blast radius if any one of the files is lost for some reason.
It also means:
users
file to save their editor settings, without also pulling in the_credentialSecret
from theruntime
file.With this change, we will leave the existing
.config.json
in place. The logic is:.config.json
exists and.config.nodes.json
does not exist.config.json
to the four new files.config.json
and.config.nodes.json
both exist.config.json
is newer, migrate it to the four new files.config.nodes.json
is newer, don't do any migration - use the four new files that already existWe will leave the old
.config.json
in place because it eases the path if a user chooses to downgrade to pre 1.2 - they won't be left with no projects/_credentialSecret etc in place. This is more likely during the initial beta period of 1.2. We will begin to remove the old.config.json
file in 1.3 or 2.0.