Commit ac86367
lib/secrets: trim all right-hand newlines with jq (#237)
Passwords declared in external files can now end with multiple
newlines.
Consider:
bash> cat --show-all /path/to/secret/password
hunter2$
$
bash> # Before (with rstrimstr):
bash> jq -n --rawfile passwordContent /path/to/secret/password \
'{password: ($passwordContent | rtrimstr("\n")), }'
{
"password": "hunter2\n"
}
bash> # After (with regex):
bash> jq -n --rawfile passwordContent /path/to/secret/password \
'{password: ($passwordContent | sub("\n+$"; "")), }'
{
"password": "hunter2"
}
Co-authored-by: Kiri Carlson <kiri@walawren.com>1 parent cf00e69 commit ac86367
2 files changed
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
| 127 | + | |
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| |||
0 commit comments