sops icon indicating copy to clipboard operation
sops copied to clipboard

Allow easy embedding of sops inside other Go CLI

Open mitar opened this issue 1 year ago • 2 comments

Currently there is a lot of logic in cmd/sops package. But because it is a main package it is not really possible to reuse that from another CLI. I made gitlab-config tool which allows one to configure GitLab projects from a file. And I encrypt secrets using sops. So to make life easier for users I wanted to embed sops as a sub-command in gitlab-config tool, so that you can call gitlab-config sops .... Current code structure does not allow that. But it is relatively easy to do so, I made it in two commits in my fork:

  • https://github.com/tozd/sops/commit/00eeae52d11d0a81d8a39bc54c043a42f62c8be6
  • https://github.com/tozd/sops/commit/4ff776e608171c0c71439c5ee8643aefeafbe57d

Would this be something I could made a PR for? It would remove my last reason why I have a SOPS fork.

mitar avatar Jan 04 '24 13:01 mitar

I know too little about go to be able to judge the changes. What do @getsops/maintainers think?

felixfontein avatar Jan 05 '24 16:01 felixfontein

It is really just a way to get main function to be importable. This introduces a new API landscape, but CLI is in my view already kinda API.

mitar avatar Jan 05 '24 17:01 mitar