-
Notifications
You must be signed in to change notification settings - Fork 882
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configurable indentation for yaml output in .sops.yaml #900
Comments
I did a quick dive into the code and due to how the code is structured, there doesn't appear to be any quick or easy way to implement this or otherwise make the YAML store receive configuration parameters. What would likely need to be done is a larger refactor that would allow configurations to be passed down to all of the stores, but that appeared to be a large amount of effort. |
I would like to add to this one idea, which is: Could things be implemented in such a way that EditorConfig is applied? It looks to me like an up-to-date parser library for it does exist in Go, so it should be possible to integrate it into SOPS. Though I have no idea if people actually like this idea. Personally I would love it. Let me know if this makes sense, I'd be happy to try implementing something with some guidance (it's been a while since I have written something in Go, but hey... gotta start contributing something at some point). |
But would you be open to having that as a feature or do you generally not like the idea? In case of the former maybe I could try what I can come up with. |
I personally don't like the idea of using something like EditorConfig. IMO such formatting details should be specified in .sops.yaml or on command line, but not in arbitrary 3rd party configs that are otherwise unrelated to sops. |
I agree with @felixfontein. SOPS shouldn't have knowledge of or attempt to handle anything third party related. |
Or there shouldn't be a hardcoded indentation set and use the default from |
Two words: backwards compatibility. :) |
@felixfontein but it causes a problem that a lot of us notice, |
@budimanjojo I do not think anyone is opposed to making indentation configurable. The only PR we have in this direction right now, #930, is unfortunately not finished and nobody wanted to pick it up and continue with it (#900 (comment)). If your main concern is yamllint, please note that yamllint can be configured: https://yamllint.readthedocs.io/en/stable/configuration.html#ignoring-paths You can use that to ignore all |
Understood, it's still a valid yaml nonetheless. Only a bit annoying to my eyes 😢 |
I hate 4 spaces. This would be great to have! |
4 spaces sucks, its so bad, this feature is the best |
If you don't have to add anything to the issue, and apparently didn't bother to write a PR to fix the issue, please don't bother everyone subscribed to this topic with your whimsies regarding 4 spaces. The problem is known and clear to everyone involved, so all that is needed is someone to go ahead and fix it. If it bothers you so much, you are the right person to do it. It probably takes as much time as complaining here. |
bahaha! |
i know its tedious but i do agree, it would be nice. Although, if its important enough then create a pr for it. Plus, its easy enough just to ignore any sops encrypted files in your linter if that is what the hype is all about |
Hello, fellow sops enjoyers 🥇 I got a workaround until one of us feels like refactoring a bunch of Go code. 👀 🍭 YQ to resuce https://github.com/mikefarah/yq use yq eval plus pretty print to output to new fixed file
use yq eval plus --inplace (-i) to update that badboy without creating new file
🎭 |
yq doesn't help. It changes only encrypted file. When I open secrets.yml in vim or VSCode it has 4 spaces again! |
Hi, |
It would be great if we could configure our indentation for yaml in the .sops.yaml configuration file. Right now it's just hardcoded to set the indent to 4 all the time.
https://github.com/mozilla/sops/blob/66043e71a81787d6513bc2e5505a29aac67dc6f1/stores/yaml/store.go#L322
Yaml spec does not dictate 4 spaces.
https://yaml.org/spec/1.2/spec.html#id2777534
The text was updated successfully, but these errors were encountered: