-
-
Notifications
You must be signed in to change notification settings - Fork 883
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #352 from rabbitt/refactor-location
refactor locations to remove a bit of redundancy
- Loading branch information
Showing
15 changed files
with
169 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<% if @location_cfg_append -%> | ||
<%- @location_cfg_append.sort_by {|k,v| k}.each do |key,value| -%> | ||
<%- if value.is_a?(Hash) -%> | ||
<%- value.each do |subkey,subvalue| -%> | ||
<%- Array(subvalue).each do |asubvalue| -%> | ||
<%= key %> <%= subkey %> <%= asubvalue %>; | ||
<%- end -%> | ||
<%- end -%> | ||
<%- else -%> | ||
<%- Array(value).each do |asubvalue| -%> | ||
<%= key %> <%= asubvalue %>; | ||
<%- end -%> | ||
<%- end -%> | ||
<%- end -%> | ||
<% end -%> | ||
<% if @location_custom_cfg_append -%> | ||
<%- @location_custom_cfg_append.each do |key,value| -%> | ||
<%- if value.is_a?(Hash) -%> | ||
<%- value.each do |subkey,subvalue| -%> | ||
<%- Array(subvalue).each do |asubvalue| -%> | ||
<%= key %> <%= subkey %> <%= asubvalue %> | ||
<%- end -%> | ||
<%- end -%> | ||
<%- else -%> | ||
<%- Array(value).each do |asubvalue| -%> | ||
<%= key %> <%= asubvalue %> | ||
<%- end -%> | ||
<%- end -%> | ||
<%- end -%> | ||
<% end -%> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
location <%= @location %> { | ||
<% if @location_allow -%> | ||
<%- @location_allow.each do |allow_rule| -%> | ||
allow <%= allow_rule %>; | ||
<%- end -%> | ||
<% end -%> | ||
<% if @location_deny -%> | ||
<%- @location_deny.each do |deny_rule| -%> | ||
deny <%= deny_rule %>; | ||
<%- end -%> | ||
<% end -%> | ||
<% if @location_custom_cfg_prepend -%> | ||
<%- @location_custom_cfg_prepend.each do |key,value| -%> | ||
<%- if value.is_a?(Hash) -%> | ||
<%- value.each do |subkey,subvalue| -%> | ||
<%- Array(subvalue).each do |asubvalue| -%> | ||
<%= key %> <%= subkey %> <%= asubvalue %> | ||
<%- end -%> | ||
<%- end -%> | ||
<%- else -%> | ||
<%- Array(value).each do |asubvalue| -%> | ||
<%= key %> <%= asubvalue %> | ||
<%- end -%> | ||
<%- end -%> | ||
<%- end -%> | ||
<% end -%> | ||
<% if @location_cfg_prepend -%> | ||
<%- @location_cfg_prepend.sort_by {|k,v| k}.each do |key,value| -%> | ||
<%- if value.is_a?(Hash) -%> | ||
<%- value.each do |subkey,subvalue| -%> | ||
<%- Array(subvalue).each do |asubvalue| -%> | ||
<%= key %> <%= subkey %> <%= asubvalue %>; | ||
<%- end -%> | ||
<%- end -%> | ||
<%- else -%> | ||
<%- Array(value).each do |asubvalue| -%> | ||
<%= key %> <%= asubvalue %>; | ||
<%- end -%> | ||
<%- end -%> | ||
<%- end -%> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
alias <%= @location_alias %>; | ||
<% if defined? @autoindex -%> | ||
autoindex <%= @autoindex %>; | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<% if defined? @www_root -%> | ||
root <%= @www_root %>; | ||
<% end -%> | ||
<% if @try_files -%> | ||
try_files<% @try_files.each do |try| -%> <%= try %><% end -%>; | ||
<% end -%> | ||
<% if defined? @autoindex -%> | ||
autoindex <%= @autoindex %>; | ||
<% end -%> | ||
<% if @index_files.count > 0 -%> | ||
index <% Array(@index_files).each do |i| %> <%= i %><% end %>; | ||
<% end -%> | ||
<% @rewrite_rules.each do |rewrite_rule| -%> | ||
rewrite <%= rewrite_rule %>; | ||
<% end -%> | ||
<% if defined? @auth_basic -%> | ||
auth_basic "<%= @auth_basic %>"; | ||
<% end -%> | ||
<% if defined? @auth_basic_user_file -%> | ||
auth_basic_user_file <%= @auth_basic_user_file %>; | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<% if @location_custom_cfg -%> | ||
<%- @location_custom_cfg.sort_by {|k,v| k}.each do |key,value| -%> | ||
<%- if value.is_a?(Hash) -%> | ||
<%- value.each do |subkey,subvalue| -%> | ||
<%- Array(subvalue).each do |asubvalue| -%> | ||
<%= key %> <%= subkey %> <%= asubvalue %>; | ||
<%- end -%> | ||
<%- end -%> | ||
<%- else -%> | ||
<%- Array(value).each do |asubvalue| -%> | ||
<%= key %> <%= asubvalue %>; | ||
<%- end -%> | ||
<%- end -%> | ||
<%- end -%> | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<% if defined? @www_root -%> | ||
root <%= @www_root %>; | ||
<% end -%> | ||
<% if @fastcgi_split_path -%> | ||
fastcgi_split_path_info <%= @fastcgi_split_path %>; | ||
<% end -%> | ||
<% if @try_files -%> | ||
try_files<% @try_files.each do |try| -%> <%= try %><% end -%>; | ||
<% end -%> | ||
include <%= @fastcgi_params %>; | ||
fastcgi_pass <%= @fastcgi %>; | ||
<% if defined? @fastcgi_script %> | ||
fastcgi_param SCRIPT_FILENAME <%= @fastcgi_script %>; | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<% if @proxy_cache -%> | ||
proxy_cache <%= @proxy_cache %>; | ||
proxy_cache_valid <%= @proxy_cache_valid %>; | ||
<% end -%> | ||
proxy_pass <%= @proxy %>; | ||
proxy_read_timeout <%= @proxy_read_timeout %>; | ||
proxy_connect_timeout <%= @proxy_connect_timeout %>; | ||
proxy_redirect <%= @proxy_redirect %>; | ||
<% @proxy_set_header.each do |header| -%> | ||
proxy_set_header <%= header %>; | ||
<% end -%> | ||
<% if @proxy_method -%> | ||
proxy_method <%= @proxy_method %>; | ||
<% end -%> | ||
<% if @proxy_set_body -%> | ||
proxy_set_body <%= @proxy_set_body %>; | ||
<% end -%> | ||
<% @rewrite_rules.each do |rewrite_rule| -%> | ||
rewrite <%= rewrite_rule %>; | ||
<% end -%> | ||
<% if defined? @auth_basic -%> | ||
auth_basic "<%= @auth_basic %>"; | ||
<% end -%> | ||
<% if defined? @auth_basic_user_file -%> | ||
auth_basic_user_file <%= @auth_basic_user_file %>; | ||
<% end -%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
stub_status on; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.