nginx/docker-nginx

`10-listen-on-ipv6-by-default.sh` should cover templates that supported by `20-envsubst-on-templates.sh`

Closed this issue · 6 comments

markxp commented

Is your feature request related to a problem? Please describe

Although 20-envsubst-on-templates.sh support environment varibable substitution, I still want the incompleted server config be supported by 10-listen-on-ipv6-by-default.sh.

Describe the solution you'd like

Currently, 10-listen-on-ipv6-by-default.sh only parse DEFAULT_CONF_FILE, defined in line 13.
The value of DEFAULT_CONF_FILE="etc/nginx/conf.d/default.conf"
I suggest to support "etc/nginx/templates/default.conf.template" or enable a enironment variable read at line 13.

Such as
DEFAULT_CONF_FILE= "${NGINX_DEFAULT_CONF:-etc/nginx/templates/default.conf.template}"

Hi @markxp!

What's the point to use the srcipt to change the template you're already providing manually, and, thus, are able to change the way you want?

markxp commented

I temporary changed one line in 10-listen-on-ipv6-by-default.sh:
from:
DEFAULT_CONF_FILE="etc/nginx/templates/default.conf"
to:
DEFAULT_CONF_FILE="etc/nginx/templates/default.conf.template"

I know this is an ugly patch. Is there any idea?

markxp commented

To add more context, I'd like to change listening port for my nginx pool.
So, my nginx.conf.template looks like this:

server { listen ${PORT}; ... }

oxpa commented

@markxp the purpose of 10-listen-on-ipv6-by-default.sh is to make the default nginx installation usable in the most primitive sense. It's not really about tailoring the setup to your needs. It is there, say, for ipv6 only networks and similar setups where ipv4 socket just won't do. And so problem you describe is out of scope for the script.

I see at least two ways you can achieve your goal:

  • just use a template where you want a template. As you correctly highlight 20-envsubst-on-templates.sh does exactly that.
  • copy the script to become, say, 15-listen-on-ipv6-by-default.sh and make whatever change you need in there. entrypoint.sh doesn't limit you to the scripts provided in the image, it will easily execute anything else.

I don't think we should change the script in the image. It works well and it would be best to keep the scope of the script unchanged.

oxpa commented

As a reference for why the script is there: #394
There were quite a few issues with ipv4/v6 over the years.

markxp commented

thanks for your reply.