vhost: Add support for custom matchers and specifying response status
This commit is contained in:
@@ -1,4 +1,15 @@
|
||||
---
|
||||
_vhost_matcher_defaults:
|
||||
match_headers: {}
|
||||
match_method: []
|
||||
_vhost_matchers: >-
|
||||
{{
|
||||
vhost_matchers
|
||||
| map('combine', _vhost_matcher_defaults)
|
||||
| zip(vhost_matchers)
|
||||
| map('combine')
|
||||
}}
|
||||
|
||||
_vhost_location_defaults:
|
||||
type: "{{ vhost_type }}"
|
||||
headers: "{{ vhost_headers }}"
|
||||
@@ -25,12 +36,36 @@ _vhost_location_defaults:
|
||||
|
||||
respond_content: "{{ vhost_respond_content if vhost_type == 'respond' else '' }}"
|
||||
respond_content_type: "{{ vhost_respond_content_type }}"
|
||||
respond_status: "{{ vhost_respond_status }}"
|
||||
|
||||
matchers: "{{ _vhost_matchers }}"
|
||||
|
||||
_vhost_locations: "{{ vhost_locations + [{'path': ''}] }}"
|
||||
|
||||
_vhost_locations_complete: "{{
|
||||
_vhost_locations
|
||||
| map('combine', _vhost_location_defaults)
|
||||
| zip(_vhost_locations)
|
||||
| map('combine')
|
||||
}}"
|
||||
_vhost_locations_withdefaults: >-
|
||||
{{
|
||||
_vhost_locations
|
||||
| map('combine', _vhost_location_defaults)
|
||||
| zip(
|
||||
_vhost_locations
|
||||
)
|
||||
| map('combine')
|
||||
| map('combine', {'matchers': [{'name': ''}]}, list_merge='append')
|
||||
}}
|
||||
|
||||
_vhost_locations_complete: >-
|
||||
{{
|
||||
_vhost_locations_withdefaults |
|
||||
sort(attribute='path') |
|
||||
zip(
|
||||
_vhost_locations_withdefaults |
|
||||
subelements('matchers') |
|
||||
map('combine') |
|
||||
groupby('path') |
|
||||
map('last') |
|
||||
map('community.general.remove_keys', ['matchers', 'path']) |
|
||||
map('community.general.dict_kv', 'matchers')
|
||||
) |
|
||||
map('combine') |
|
||||
reverse
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user