envplate
envplate copied to clipboard
Recursive substitution?
I would like to put substitutions on the right hand side of the :, or a better solution would be great too.
Expected Behavior
tunnel_host = "${SERVER_TUNNEL_HOST:-${SERVER_URL:-http://$(hostname)}}"
would render in this precedence:
- SERVER_TUNNEL_HOST
- SERVER_URL
- http://hostname
Actual Behavior
tunnel_host = "${SERVER_URL:-http://$(hostname)}"
Steps to Reproduce (including precondition)
SERVER_TUNNEL_HOST is unset
SERVER_URL=http://my.server.com
tunnel_host = "${SERVER_TUNNEL_HOST:-${SERVER_URL:-http://$(hostname)}}"
renders
tunnel_host = "${SERVER_URL:-http://$(hostname)}"
Your Environment
- OS: docker.io/debian:11
- envplate version: 1.0.2
Another scenario
auth = "${SERVER_AUTH_USER:?${SERVER_AUTH_PASSWORD:?${SERVER_AUTH_USER}:${SERVER_AUTH_PASSWORD}}}"
This should verify that SERVER_AUTH_USER & SERVER_AUTH_PASSWORD are both set, then set the line to the value of:
auth = "${SERVER_AUTH_USER}:${SERVER_AUTH_PASSWORD"
@djarbz Have you ever been able to find a solution for this ?
Unfortunately I have not.
@djarbz that's a pity, I'm looking for a workaround too. Have you tried escaping and such like the empty value needs as well ?
I haven't touched this in quite some time, I don't even recall what project I was wanting this for.
@djarbz OK understood; in other cases you need to go thought your files using AWK or SED so it's pretty useful!
@mavogel Is this something you might can look into ?
are you expecting hostname also to be substituted?
A single replacement in the default might be easy with a more complex regular expression and some logic. But multiple and especially nested ones are very difficult in regexp