How to use string substitution (hyphen to underscore) for key inside strenv? #2193
Unanswered
sanzoghenzo
asked this question in
Q&A
Replies: 2 comments
-
Oh wait, I just tried to use underscores in my secrets keys instead of hyphens, but I realized that the value inside the Is there any way to use the key (or better yet, the result of an operator) as a dynamic parameter for |
Beta Was this translation helpful? Give feedback.
0 replies
-
....aaaaaand now I see that there's an open issue for this |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there, first of all, many thanks for this wonderful tool!
I'm trying to handle docker swarm secrets and configs updates as described here, but using Task and yq.
My docker compose file (I call it
stack.yaml
) is something like thisTo sum up: for each entry in the
configs
andsecrets
sections, I need to add thename
attribute and set it to thekey
+ the md5sum of the.file
.With the following I can successfully build the envvars with the md5sum of the files
I'm stuck on the second part, which is to set the
name
attribute; since the variables from the-o=shell
output have underscores in place of hyphens, I need to replace them in thekey
s in order to match them withstrenv
. I tried with this:but I got
Error: bad expression, got close brackets without matching opening bracket
I bet this is because the pipe operator is not allowed inside parenthesis of other operators (strenv in this case).
Is there a smarter way to solve this?
Beta Was this translation helpful? Give feedback.
All reactions