ejson2env icon indicating copy to clipboard operation
ejson2env copied to clipboard

Add option to skip shell escaping

Open c-w opened this issue 2 years ago • 0 comments

This pull request adds a flag --raw to skip shell escaping the values that are being output. The use-case I have for this flag is two-fold:

  1. The current escaping is quite aggressive and adds quotes in scenarios where they're not strictly necessary (e.g. export FOO=bar+baz works fine but currently gets escaped); adding this flag means more predictable output in scenarios where the user knows that the secrets won't contain any shell-specific special characters.

  2. More importantly adding this flag means that ejson2env can now be used on Github Actions to set environment variables (docs) via ejson2env --raw path/to/secrets.ejson >> "${GITHUB_ENV}". Before this PR, this approach wouldn't work as Github Actions doesn't interpret escape characters.

c-w avatar Dec 18 '23 14:12 c-w