Support for using `--set` for array as value
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 23.1k
- Forks
- 1.1k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 9
Description
As described in the documentation for the --set option, individual elements can be added to an array like this:
$ sops --set '["an_array"][1] "secretuser2"' ~/git/svc/sops/example.yaml
As a shortcut, it would be nice if it were also possible for a full JSON array to be specified as a value. When I try to do this, though, the value set into the encrypted file is null. For example:
$ sops --set '["an_array"] ["element"]' test.yaml
$ sops -d test.yaml
an_array: null
Note that I can set an array as the value for a property on a map:
$ sops --set '["arr"] {"nested": ["element"]}' test.yaml
$ sops -d test.yaml
an_array:
nested:
- element
Note that I was using version 3.7.3 for these tests.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the CLI's --set option and reproduce the documented array-value example using sops 3.7.3. Trace why a full JSON array becomes null while an array nested in a map works, then add coverage for direct array values and verify decryption preserves the elements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100