Use mapstructure to (de-)serialize internal metadata; move metadata processing from specific stores to general place#2120
Conversation
af435dc to
97fea11
Compare
Signed-off-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Felix Fontein <felix@fontein.de>
97fea11 to
0f3238f
Compare
Signed-off-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Felix Fontein <felix@fontein.de>
| }, | ||
| }, | ||
| sops.TreeItem{ | ||
| Key: "agekey", |
There was a problem hiding this comment.
Should be
| Key: "agekey", | |
| Key: "age", |
I believe?
| }, | ||
| }, | ||
| sops.TreeItem{ | ||
| Key: "agekey", |
There was a problem hiding this comment.
Should be
| Key: "agekey", | |
| Key: "age", |
I believe? Also not caught by tests, as I don't believe we check for it as expected output.
|
|
||
| // DecodeNewLines replaces \\n with \n for all string values in the map. | ||
| // Used by config stores that do not handle multi-line values (ini, dotenv). | ||
| func DecodeNewLines(m map[string]interface{}) { |
There was a problem hiding this comment.
Does not appear to be used anymore? Same for EncodeNewLines. Also wonder if because this is no longer called, we are not introducing regressions.
There was a problem hiding this comment.
In the previous versions of the INI and DotEnv stores, these function were used to process the metadata - despite the same transformation being made afterwards (store) resp. before (load) in the plain file variant. (As these transformations are idempotent, this never got noticed before.)
I guess we can simply remove them now; the plain loader/storer of these stores already handles newlines. WDYT?
Co-authored-by: Hidde Beydals <hiddeco@users.noreply.github.com> Signed-off-by: Felix Fontein <felix@fontein.de>
Signed-off-by: Felix Fontein <felix@fontein.de>
Right now, metadata is handled quite strangely when flattened (by going through JSON), and all stores somehow have to deal with metadata. This PR cleans this up as follows:
sops.TreeBranch, and provide three options for handling flattening (none; keepsopstoplevel map; flatten completely).While this is a breaking change, I think this is still OK:
This is related to #1401, #1338, #1046, #1009, which were earlier attempts to introduce mapstructure.