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

feat: Unconditionally produce debug comments #2141

Merged
merged 1 commit into from Jan 22, 2023
Merged

Conversation

rhansen
Copy link
Collaborator

@rhansen rhansen commented Jan 18, 2023

Rationale for eliminating the check to see if the DEBUG environment variable holds a true value:

  • The DEBUG environment variable might be set on a container (for purposes specific to that container, not nginx-proxy) to a value that cannot be parsed as a bool, which would break nginx-proxy.
  • It simplifies the template.
  • It eliminates a cold code path.
  • It avoids heisenbugs.
  • It makes debugging easier for users.

Also delete the debug info tests, as they are fragile (e.g., they break if IPv6 is enabled) and they provide limited value.

Alternatively, we could avoid collision with the container's use of the DEBUG environment variable by using a container label such as com.google.nginx-proxy.nginx-proxy.debug. I think doing so has dubious value, especially if we want to attempt backwards compatibility with the DEBUG environment variable.

Fixes #2139

cc @GGORG0

README.md Outdated Show resolved Hide resolved
@buchdag
Copy link
Member

buchdag commented Jan 18, 2023

@rhansen I completely agree on removing the per proxied container DEBUG variable, but I'm not certain about removing the global one. Should we not at least provide a way to have a debug free nginx config ?

@rhansen
Copy link
Collaborator Author

rhansen commented Jan 18, 2023

Should we not at least provide a way to have a debug free nginx config ?

No, I don't think it's necessary. The extra comments are harmless.

Rationale for eliminating the check to see if the `DEBUG` environment
variable holds a true value:
  * The `DEBUG` environment variable might be set on a container (for
    purposes specific to that container, not `nginx-proxy`) to a value
    that cannot be parsed as a bool, which would break `nginx-proxy`.
  * It simplifies the template.
  * It eliminates a cold code path.
  * It avoids heisenbugs.
  * It makes debugging easier for users.

Also delete the debug info tests, as they are fragile and they provide
limited value.

Alternatively, we could avoid collision with the container's use of
the `DEBUG` environment variable by using a container label [1] such
as `com.google.nginx-proxy.nginx-proxy.debug`.  I think doing so has
dubious value, especially if we want to attempt backwards
compatibility with the `DEBUG` environment variable.

Fixes nginx-proxy#2139

[1] https://docs.docker.com/engine/reference/commandline/run/#-set-metadata-on-container--l---label---label-file

Co-authored-by: Nicolas Duchon <nicolas.duchon@gmail.com>
@rhansen
Copy link
Collaborator Author

rhansen commented Jan 19, 2023

@GGORG0 Does this PR solve your problem?

@buchdag
Copy link
Member

buchdag commented Jan 20, 2023

The extra comments are harmless.

I had more in mind users that would like a "clean" config generated, in the same way as you don't always want debug informations on your application logs. I leave that up to you, this can be merged as is so that @GGORG0 can test it more easily.

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

Successfully merging this pull request may close these issues.

$DEBUG environment variable
2 participants