2 ms·
> jq -r \ > '.apps.http.servers.srv1.routes[0] > | .match[0].header.[env.AUTH_USER_HEADER][0] = "$username"' > That's an error because you can't select a
by cryptonector 3y ago
> jq -r \
> '.apps.http.servers.srv1.routes[0]
> | .match[0].header.[env.AUTH_USER_HEADER][0] = "$username"'
> That's an error because you can't select an env var key '[env.AUTH_USER_HEADER]' in the middle of a chain like that, only immediately following a pipe:
> | .match[0].header | .[env.AUTH_USER_HEADER][0] = "$username"'
You can use `env.AUTH_USER_HEADER` as a key the way you wanted. The issue is that you had to write `... | .match[0].header[env.AUTH_USER_HEADER] ...` -- no `.` between "header" and the index operator!
This complaint is a fairly frequent one, so in fact we did "fix" this in 1.7! You can now write `.a.[0]` and it works.
- deleted 3y ago[deleted]