-
Notifications
You must be signed in to change notification settings - Fork 889
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
Allow to override fileName with different value #1332
Conversation
f91d5ea
to
b93d1dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. One clarifying comment. Should we add an example for documentation? Something like "Encrypting data from stdout and writing to a new file"
Yeah, documentation is definitely needed. I'll work on that next. |
db1afd7
to
3b973b6
Compare
README.rst
Outdated
Encrypting and decrypting from other programs | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
When using ``sops`` in scripts or from other programs, there are often situations where you do not want to write encrypted or decrypted data to disk. The best way to avoid this is to pass data to SOPS via stdin, and to let SOPS write data to stdout. By default, the encrypt and decrypt operations write data to stdout already. To pass data via stdin, you need to pass ``/dev/stdin`` as the input filename. Please note that this only works on Unix-like operating systems such as macOS and Linux. On Windows, you have to use named pipes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about Windows here. Is it true that you need named pipes for this? Or is there another mechanism?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With #1104, it would simply be a -
. I would need to revise this to incorporate my own feedback, as it appears the contributor gave up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update this section once I have recreated the above.
3b973b6
to
8964088
Compare
$ sops --decrypt test.enc.yaml | ||
|
||
|
||
Encrypting and decrypting from other programs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In think we need to line wrap the documentation, as that seems to be the case for the majority of the sections in the README and eases reading in e.g. a terminal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd actually argue that explicitly wrapping lines is bad, since terminals by default wrap lines and thus you use the full terminal width, as opposed to explicit line wrapping, which looks mostly bad except if it is applied consistently and your terminal is wider than the limit used in the file. But that's something we should look at at another point in time :)
I've wrapped lines to a similar length as other parts of this file for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides my comment around linewraping, this looks good to me. Thanks @felixfontein 🙇
26c77c7
to
4aac57a
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>
4aac57a
to
2678f2d
Compare
@hiddeco thanks a lot for reviewing this! |
This adds a
--filename-override
parameter which can be used when providing data to encrypt (or decrypt) from/dev/stdin
.For example:
echo 'foo: bar' | ~/go/bin/sops --encrypt --filename-override foobar.yaml /dev/stdin
will take the data to encrypt from theecho
command's output, and act as iffoobar.yaml
has been supplied instead of/dev/stdin
. This is relevant for finding creation rules in the SOPS configuration, and for determining the input and output type if these are not explicitly specified via--input-type
and--output-type
.Fixes #594.