I'm trying to extract values from a SOPS-encrypted JSON file to export them into environment variables in order to run a web app, but the extraneous newlines keeps driving me crazy.
For example, given this test.json
(which is then encrypted with SOPS into test.enc.json
),
{
"password": "the cake is a lie",
"secret": "shut up about the sun"
}
when I try to extract "password"
, a newline will be added to the end:
$ sops --extract '["password"]' --decrypt test.enc.json)
$ echo $password
the cake is a lie
$
Tried trimming the newline with tr -d "\n"
and with sed
but no joy.