Skip to content

Generalize where* functions #83

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 7 commits into from
May 4, 2015

Conversation

md5
Copy link
Contributor

@md5 md5 commented May 3, 2015

This PR generalizes the where* functions to allow an array or slice of any map or struct type.

This should make it possible to fix nginx-proxy/nginx-proxy#115 since the updated where function can be used like this: {{where (where $container.Addresses "Proto" "tcp") "Port" "80" | len}} to detect the case where there are multiple ports exposed but not port 80.

I also introduced a templateTestList type with a run function to simplify writing tests that actually execute a template and check its output. Let me know if you'd like that split into a separate PR.

@md5
Copy link
Contributor Author

md5 commented May 3, 2015

Looks like os.Unsetenv is only in Go 1.4+, causing the Travis failure. I've changed it to os.Setenv("DOCKER_HOST","")

@thaJeztah
Copy link
Contributor

Are there blockers for Go 1.4 in docker-gen, or are people importing it in other projects? Perhaps 1.4 isn't a bad thing to use (Docker, for example, very recently dropped 1.3 support)

@md5
Copy link
Contributor Author

md5 commented May 4, 2015

Good point @thaJeztah.

@jwilder
Copy link
Collaborator

jwilder commented May 4, 2015

I don't see any reason to keep 1.3 around. docker-gen isn't really intended to be used as a library right now so it should not matter if the code is dependent on 1.4 features.

@md5 md5 force-pushed the generalize-where branch from 844fa87 to 7d4dccc Compare May 4, 2015 13:22
@md5
Copy link
Contributor Author

md5 commented May 4, 2015

@jwilder I've dropped commit 844fa87, so the Travis build now fails again on 1.3.

@jwilder
Copy link
Collaborator

jwilder commented May 4, 2015

@md5 I removed 1.3 from travis. If you rebase, it should pass now.

@md5 md5 force-pushed the generalize-where branch from 7d4dccc to 3ce30e4 Compare May 4, 2015 15:52
@md5
Copy link
Contributor Author

md5 commented May 4, 2015

Rebased. Travis is green 👍

jwilder added a commit that referenced this pull request May 4, 2015
@jwilder jwilder merged commit 8b99177 into nginx-proxy:master May 4, 2015
@jwilder
Copy link
Collaborator

jwilder commented May 4, 2015

Thanks @md5!

@md5 md5 deleted the generalize-where branch May 4, 2015 16:38
@md5
Copy link
Contributor Author

md5 commented May 4, 2015

You're welcome! 👍

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.

Prevent Generating Broken Config
3 participants