pound_config_generator 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/pound.erb CHANGED
@@ -1,14 +1,4 @@
1
1
  <%
2
- all_sites = []
3
- Array(config['https_sites']['sites']).each do |n,s|
4
- all_sites << s['domain']
5
- end if config['https_sites']
6
- Array(config['http_sites']['sites'] ).each do |n,s|
7
- all_sites << s['domain']
8
- end if config['http_sites']
9
- all_sites.uniq! # kill duplicates
10
- all_sites.sort! # sort by domain
11
-
12
2
  cert_path = \
13
3
  config['https_sites']['cert_path'] || '/etc/pound/certs/cert.pem'
14
4
 
@@ -20,14 +10,14 @@
20
10
  User "www-data"
21
11
  Group "www-data"
22
12
  #WebDAV 0
23
- ## Logging: (goes to syslog by default)
24
- LogLevel 5
13
+ ## Logging:
14
+ LogLevel 1
25
15
  ## how often to check backends (seconds)
26
- Alive 30
16
+ Alive 5
27
17
  ## how long pound will wait for client connection (seconds)
28
- Client 60
29
- ## timout to backend servers (seconds)
30
- TimeOut 100
18
+ Client 30
19
+ ## timeout to backend servers (seconds)
20
+ TimeOut 30
31
21
 
32
22
  <% if https_sites %>
33
23
  # ----------------------------------------------------------------
@@ -41,19 +31,10 @@ ListenHTTPS
41
31
  AddHeader "X-Forwarded-Proto: https"
42
32
  HeadRemove "X-Forwarded-Proto"
43
33
  <% https_sites.sort_by { |n,s| s['domain'] }.each do |name, site| %>
44
- <% this_domain = site['domain'] || 'test.domain.com' %>
34
+ <% this_domain = site['domain'] || false %>
45
35
  # <%= name.upcase %>
46
36
 
47
37
  Service
48
- HeadRequire "Host: <%= this_domain.gsub(/\./, '\.') %>"
49
- <% all_sites.reject { |d| this_domain == d }.each do |domain| %>
50
- HeadDeny "Host: <%= domain.gsub(/\./, '\.') %>"
51
- <% end # all_sites.each %>
52
-
53
- <% if site['static'] %>
54
- URL "<%= site['filter'] || '.*.(css|js|jpg|gif|png)' %>"
55
- <% end %>
56
-
57
38
  <% 1.upto(site['num_ports'] || 5) do |i| %>
58
39
  <% Array(site['backends']).each do |backend| %>
59
40
  BackEnd
@@ -66,23 +47,6 @@ ListenHTTPS
66
47
  <% end # 0 - num_ports %>
67
48
  End
68
49
  <% end # https_sites[:sites].each %>
69
-
70
- <% if http_sites %>
71
- <% http_sites.sort_by { |n,s| s['domain'] }.each do |name, site| %>
72
- <% next unless site['redirect'] %>
73
- <% this_domain = site['domain'] || 'test.domain.com' %>
74
- # <%= name.upcase %> (redirect)
75
- Service
76
- HeadRequire "Host: <%= this_domain.gsub(/\./, '\.') %>"
77
- <% all_sites.reject { |d| this_domain == d }.each do |domain| %>
78
- HeadDeny "Host: <%= domain.gsub(/\./, '\.') %>"
79
- <% end # all_sites.each %>
80
-
81
- Redirect "http://<%= this_domain %>"
82
- End
83
-
84
- <% end # http_sites[:sites].each %>
85
- <% end # if HTTP %>
86
50
  End
87
51
  <% end # if HTTPS %>
88
52
 
@@ -93,16 +57,9 @@ ListenHTTP
93
57
  Port 80
94
58
  xHTTP 1
95
59
  <% http_sites.sort_by { |n,s| s['domain'] }.each do |name, site| %>
96
- <% this_domain = site['domain'] || 'test.domain.com' %>
97
-
98
60
  # <%= name.upcase %>
99
61
 
100
62
  Service
101
- HeadRequire "Host: <%= this_domain.gsub(/\./, '\.') %>"
102
- <% all_sites.reject { |d| this_domain == d }.each do |domain| %>
103
- HeadDeny "Host: <%= domain.gsub(/\./, '\.') %>"
104
- <% end # all_sites.each %>
105
-
106
63
  <% 1.upto(site['num_ports'] || 5) do |i| %>
107
64
  <% Array(site['backends']).each do |backend| %>
108
65
  BackEnd
@@ -115,22 +72,5 @@ ListenHTTP
115
72
  <% end # 0 - num_ports %>
116
73
  End
117
74
  <% end # http_site[:sites].each %>
118
-
119
- <% if https_sites %>
120
- <% https_sites.sort_by { |n,s| s['domain'] }.each do |name, site| %>
121
- <% next unless site['redirect'] %>
122
- <% this_domain = site['domain'] || 'test.domain.com' %>
123
- # <%= name.upcase %> (redirect)
124
- Service
125
- HeadRequire "Host: <%= this_domain.gsub(/\./, '\.') %>"
126
- <% all_sites.reject { |d| this_domain == d }.each do |domain| %>
127
- HeadDeny "Host: <%= domain.gsub(/\./, '\.') %>"
128
- <% end # all_sites.each %>
129
-
130
- Redirect "https://<%= this_domain %>"
131
- End
132
-
133
- <% end # https_sites[:sites].each %>
134
- <% end # if HTTPS %>
135
75
  End
136
- <% end # if HTTP %>
76
+ <% end # if HTTP %>
@@ -1,7 +1,6 @@
1
1
  #! /usr/bin/env ruby
2
2
  require 'erb'
3
3
  require 'yaml'
4
- # %w(erb yaml).each &method(:require) # ooo... look how clever i am. pffftt...
5
4
 
6
5
  def error(message) puts(message) || exit end
7
6
  def file(file) "#{File.dirname(__FILE__)}/#{file}" end
@@ -1,3 +1,3 @@
1
1
  module PoundConfigGenerator
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pound_config_generator
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Eric Boehs