Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recursive substitution? #45

Open
djarbz opened this issue Jul 20, 2022 · 7 comments
Open

Recursive substitution? #45

djarbz opened this issue Jul 20, 2022 · 7 comments

Comments

@djarbz
Copy link

djarbz commented Jul 20, 2022

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:

  1. SERVER_TUNNEL_HOST
  2. SERVER_URL
  3. 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"

@di-rect
Copy link

di-rect commented Dec 30, 2023

@djarbz Have you ever been able to find a solution for this ?

@djarbz
Copy link
Author

djarbz commented Dec 30, 2023

Unfortunately I have not.

@di-rect
Copy link

di-rect commented Dec 30, 2023

@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 ?

@djarbz
Copy link
Author

djarbz commented Dec 30, 2023

I haven't touched this in quite some time, I don't even recall what project I was wanting this for.

@di-rect
Copy link

di-rect commented Dec 30, 2023

@djarbz OK understood; in other cases you need to go thought your files using AWK or SED so it's pretty useful!

@di-rect
Copy link

di-rect commented Dec 30, 2023

@mavogel Is this something you might can look into ?

@enc
Copy link
Contributor

enc commented Dec 30, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants