-
Problem I'm trying to create a docker compose override yaml file from JSON, which include N amount of labels. I currently have the following setup: {
"version": "3.7",
"traefik": {
"labels": [
"traefik.http.routers.traefik-secure.tls.domains[0].main=domain1.local",
"traefik.http.routers.traefik-secure.tls.domains[0].sans=*.domain1.local",
"traefik.http.routers.traefik-secure.tls.domains[1].main=domain2.local",
"traefik.http.routers.traefik-secure.tls.domains[1].sans=*.domain2.local",
"traefik.http.routers.traefik-secure.tls.domains[N].main=domainN.local",
"traefik.http.routers.traefik-secure.tls.domains[N].sans=*.domainN.local"
]
}
} with currently the following command: yq e -P docker-compose.override.json Which results in: version: "3.7"
traefik:
labels:
- traefik.http.routers.traefik-secure.tls.domains[0].main=domain1.local
- traefik.http.routers.traefik-secure.tls.domains[0].sans=*.domain1.local
- traefik.http.routers.traefik-secure.tls.domains[1].main=domain2.local
- traefik.http.routers.traefik-secure.tls.domains[1].sans=*.domain2.local
- traefik.http.routers.traefik-secure.tls.domains[N].main=domainN.local
- traefik.http.routers.traefik-secure.tls.domains[N].sans=*.domainN.local Desired result I want to have quotes around the traefik labels like so: version: "3.7"
traefik:
labels:
- "traefik.http.routers.traefik-secure.tls.domains[0].main=domain1.local"
- "traefik.http.routers.traefik-secure.tls.domains[0].sans=*.domain1.local"
- "traefik.http.routers.traefik-secure.tls.domains[1].main=domain2.local"
- "traefik.http.routers.traefik-secure.tls.domains[1].sans=*.domain2.local"
- "traefik.http.routers.traefik-secure.tls.domains[N].main=domainN.local"
- "traefik.http.routers.traefik-secure.tls.domains[N].sans=*.domainN.local" |
Beta Was this translation helpful? Give feedback.
Answered by
ToshY
Dec 27, 2021
Replies: 1 comment
-
Got the answer yq e '... style="" | with(.traefik.labels[] ; . style="double")' docker-compose.override.json |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ToshY
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Got the answer
yq e '... style="" | with(.traefik.labels[] ; . style="double")' docker-compose.override.json