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

[Feature Request] Custom envsubst for templating with default values #592

Open
Friz-zy opened this issue Oct 28, 2021 · 5 comments
Open

Comments

@Friz-zy
Copy link

Friz-zy commented Oct 28, 2021

The problem: by default nginx in docker uses GNU envsubst that can't proceed variables with default values like ${var:-DEFAULT}. We can use a8m envsubst or stephenc envsub instead, the first one has already had a prebuilded binary for x86_64 arch and it can be easily builded with docker and golang in a separate build stage.

@thresheek
Copy link
Collaborator

What is an actual use case for that? If you're providing a template, you surely control what's inside of a template and can just not use whatever is not supported by envsubst?

@Friz-zy
Copy link
Author

Friz-zy commented Oct 28, 2021

You can create a universal template with defaults and reduce amount of variables to passing into container. Something like resolver ${RESOLVER_URL:-127.0.0.11} valid=${RESOLVER_TTL:-30s} ipv6=off; in resolver.conf.template. Without this behaviour you have to keep all this defaults values in docker-compose\helm\other things that you use for configuring and templating your setups.

@thresheek
Copy link
Collaborator

OK. But that means extra work for redoing templates in different environments that might have different defaults...

Anyway, that proposal would also mean we will have to build non-GNU envsubst for all supported platforms manually. I'm leaving it open, but it's definitely not on top of a things to implement.

@presidentio
Copy link

I'm also interested in this capability. It can simplify image configuration a lot

@ernestojpg
Copy link

I would love to have this feature as well! The idea is to have templates where most of the variables are optional, so you can run the application with little configuration, but still can be highly configurable if needed.

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