Skip to content

feat: add Internal property to Network struct #558

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

Merged
merged 1 commit into from
Dec 9, 2023

Conversation

pini-gh
Copy link
Contributor

@pini-gh pini-gh commented Sep 30, 2023

The purpose of this pull request is to add the Internal property to the Network structure so that it could be used to fix nginx-proxy/nginx-proxy#2310.

I've tested that this change makes the fix for the nginx-proxy related issue easy:

diff --git a/nginx.tmpl b/nginx.tmpl
index fb0766b..afe5c96 100644
--- a/nginx.tmpl
+++ b/nginx.tmpl
@@ -75,7 +75,7 @@
                 {{- continue }}
             {{- end }}
             {{- range sortObjectsByKeysAsc $.globals.CurrentContainer.Networks "Name" }}
-                {{- if and . .Gateway }}
+                {{- if and . .Gateway (not .Internal) }}
     #         container is in host network mode, using {{ .Name }} gateway IP
                     {{- $ip = .Gateway }}
                     {{- break }}

I have no knowledge in Go programming and it took me quite some time to come up with this proposal. Please bear with me :)

@buchdag
Copy link
Member

buchdag commented Dec 9, 2023

Nice !

@buchdag buchdag merged commit 2c58e80 into nginx-proxy:main Dec 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken testcase test/test_host-network-mode/test_host-network-mode.py
2 participants