-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
The behavior of .envsh executed by docker-entrypoint.sh #745
Comments
Hello @yu-shiba san! Indeed, the variable exported does not go into resulting runtime of nginx binary, however it's still available during the run of entrypoint scripts. So I'm not sure about the 20-envsubst-on-templates.sh remark. Let me illustrate:
|
Hello @thresheek, My apologies for not explaining properly. (It is my English problem). I have introduced a mechanism to replace environment variables in other projects using 20-envsubst-on-templates.sh. Of course, I have also installed docker-entrypoint.sh. As you indicated, the current behavior doesn't affect the .sh and .envsh series run from docker-entrypoint.sh, but I figured someone else might have the same problem. I've submitted a PR (#746) to change this behavior because it's easy to do. |
Hello @yu-shiba san! This would be a behaviour change. While I understand this might be useful for some cases, it also might accidentally leak some sensitive information to a resulting image. |
Hello @thresheek, Given the particularities of Normally, source(.) in shell is done to reflect the environment variable to itself, but in Of course, the current implementation can isolate the environment from problematic code, and if you want to pass environment variables to nginx in the first place, you can simply use In fact, nginx only uses environment variables in a few cases (like when referring to them in Lua? I have never used it myself). |
nginx can use some environment variables (and possibly some third-party modules like This means that you still need to provide an actual nginx configuration with those vars (set or unset), and whether they're exported to runtime is irrelevant... |
I had missed this. You are right, it has to be set with the nginx configuration (nginx.conf).
I guess it would be like turning
It is certainly possible, but this part seems forced.
I would like to write it this way.
|
Describe the problem
The .envsh merged in #687 is a very nice solution, but the current implementation does not passed to nginx.
This is due to bash/dash (POSIX spec?). This is because the pipeline is run in subshell.
https://www.gnu.org/software/bash/manual/html_node/Pipelines.html
The pipeline does not affect the behavior of 20-envsubst-on-templates.sh because the environment variables are reflected in the pipeline, but it may be a confusing implementation.
(In fact, I was fitted with a project that incorporated 20-envsubst-on-templates.sh.)
To Reproduce
Expected behavior
Exported environment variables are reflected in nginx
The text was updated successfully, but these errors were encountered: