File tree 3 files changed +35
-6
lines changed
3 files changed +35
-6
lines changed Original file line number Diff line number Diff line change 47
47
# nginx::resource::streamhost { 'test2.local':
48
48
# ensure => present,
49
49
# }
50
+ # @param allow
51
+ # Locations to allow connections from
52
+ # @param deny
53
+ # Locations to deny connections from
50
54
#
51
55
define nginx::resource::streamhost (
52
56
Enum['absent', 'present'] $ensure = ' present' ,
66
70
String $owner = $nginx::global_owner,
67
71
String $group = $nginx::global_group,
68
72
String $mode = $nginx::global_mode,
73
+ Array $allow = [],
74
+ Array $deny = [],
69
75
) {
70
76
if ! defined (Class[' nginx' ]) {
71
77
fail(' You must include the nginx base class before using any defined resources' )
Original file line number Diff line number Diff line change 112
112
value : [ '203.0.113.1' , '203.0.113.2' ] ,
113
113
match : %r{\s +resolver\s +203.0.113.1 203.0.113.2;}
114
114
} ,
115
+ {
116
+ title : 'should set allow(s)' ,
117
+ attr : 'allow' ,
118
+ value : [ '203.0.113.1' , '203.0.113.2' ] ,
119
+ match : %r{\s +allow\s +203.0.113.1;}
120
+ } ,
121
+ {
122
+ title : 'should set deny(s)' ,
123
+ attr : 'deny' ,
124
+ value : [ '203.0.113.1' , '203.0.113.2' ] ,
125
+ match : %r{\s +deny\s +203.0.113.1;}
126
+ } ,
115
127
{
116
128
title : 'should contain raw_prepend directives' ,
117
129
attr : 'raw_prepend' ,
Original file line number Diff line number Diff line change @@ -22,15 +22,26 @@ server {
22
22
resolver <% @resolver.each do |res| %> <%= res %> <% end %> ;
23
23
<%- end -%>
24
24
25
- <% Array(@raw_prepend).each do |line| -%>
26
- <%= line %>
27
- <% end %>
25
+ <% if @allow -%>
26
+ <%- @allow.flatten.uniq.each do |allow_rule| -%>
27
+ allow <%= allow_rule %> ;
28
+ <%- end -%>
29
+ <% end -%>
30
+ <% if @deny -%>
31
+ <%- @deny.uniq.each do |deny_rule| -%>
32
+ deny <%= deny_rule %> ;
33
+ <%- end -%>
34
+ <% end -%>
35
+
36
+ <% Array(@raw_prepend).each do |line| -%>
37
+ <%= line %>
38
+ <% end %>
28
39
29
40
proxy_timeout <%= @proxy_read_timeout %> ;
30
41
proxy_connect_timeout <%= @proxy_connect_timeout %> ;
31
42
proxy_pass <%= @proxy %> ;
32
43
33
- <% Array(@raw_append).each do |line| -%>
34
- <%= line %>
35
- <% end -%>
44
+ <% Array(@raw_append).each do |line| -%>
45
+ <%= line %>
46
+ <% end -%>
36
47
}
You can’t perform that action at this time.
0 commit comments