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

Limit which services are put in template #3

Open
emmetog opened this issue Mar 21, 2016 · 1 comment
Open

Limit which services are put in template #3

emmetog opened this issue Mar 21, 2016 · 1 comment

Comments

@emmetog
Copy link
Contributor

emmetog commented Mar 21, 2016

I've been playing around with this container and it looks great! The docs are pretty sparse though.

In particular I would like to know how to limit which services appear in the template. For example I have a consul server on a host which has different containers; a few web containers and a few databases for example. I don't want the mysql services to be put in the template, since nginx won't be routing traffic to the database. I only want certain web containers to be in the template.

Can this be done? If so, could you improve the docs?

@shufo
Copy link
Owner

shufo commented Mar 21, 2016

@emmetog

Yes, you can exclude a service from template by adding a service name to consul template file like this

nginx.conf.ctmpl

-{{ range $service := services }} {{ if ne $service.Name "consul" }}
+{{ range $service := services }} {{ if ne $service.Name "consul" }} {{ if ne $service.Name "mysql" }}

https://github.com/shufo/nginx-consul-template/blob/master/nginx.conf.ctmpl#L37

I'll add a description for this!

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

No branches or pull requests

2 participants