Skip to content

Commit

Permalink
Adding real_ip_from template rendering (#3)
Browse files Browse the repository at this point in the history
* Adding real_ip_from template

* Corrected configuration structure with relevant iteration
  • Loading branch information
Adam Bolinger authored Jun 21, 2019
1 parent 1d927d9 commit 6f5f245
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions templates/site.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ server {
access_log {{ nginx_log_dirname }}/{{ item.server.name }}-{{ nginx_access_log_filename }};
error_log {{ nginx_log_dirname }}/{{ item.server.name }}-{{ nginx_error_log_filename }};
{% endif %}

{% for k,v in item.server.iteritems() %}
{% if k.find('location') == -1 %}
{% if ((k.find('location') == -1) and (k.find('set_real_ip_from') == -1)) %}
{{ k }} {{ v }};
{% endif %}
{% endfor %}

{% for k,v in item.server.iteritems() if k.find('set_real_ip_from') != -1 %}
set_real_ip_from {{ v }};
{% endfor %}
{% for k,v in item.server.iteritems() if k.find('location') != -1 %}
location {{ v.name }} {
{% for x,y in v.iteritems() if x != 'name' %}
Expand Down

0 comments on commit 6f5f245

Please sign in to comment.