Skip to content

Commit

Permalink
Updated templates to allow to not create upstreams (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleeriz authored Apr 6, 2018
1 parent fcb0157 commit 28f0fd6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion templates/locations.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
{% set combined_config = config_block %}
{% endif %}
{% for key, value in combined_config.iteritems() %}
{% if key not in ['proxy_pass', 'path', 'server'] %}
{% if key not in ['proxy_pass', 'path', 'server', 'no_upstream'] %}
{% if value is iterable and value is not string %}
{% for array_value in value %}
{{ key }} {{ array_value }};
Expand Down
3 changes: 3 additions & 0 deletions templates/upstreams.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
{% set _ = data.update({config_block.proxy_pass: "1"}) %}
upstream {{ config_block.proxy_pass }} {
{% if 'proxy_pass' in config_block %}
{% if 'no_upstream' in config_block and config_block.no_upstream == 'true' %}
{% else %}
{% if config_block.proxy_pass in consul_services%}
{% if 'local_port' in consul_services[config_block.proxy_pass] %}
server 127.0.0.1:{{ consul_services[config_block.proxy_pass]['local_port'] }};
Expand All @@ -19,5 +21,6 @@
{% endif %}
}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}

0 comments on commit 28f0fd6

Please sign in to comment.