ts-admin 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/controller/init.rb +11 -0
- data/controller/main.rb +1 -1
- data/controller/remap.rb +3 -3
- data/lib/ts-admin/traffic_server.rb +4 -2
- data/lib/ts-admin/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fba606ded7a3826b1ea2cbddda05bcc19ca2b7a
|
4
|
+
data.tar.gz: 26a47753ba7cec3e7d728240abd0390472b4a519
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a69c6c728475b1ae22528aefeee9b5e4e60d15b1aa5a31592c53c71234a3819e54a156ec746146f1ff8fa1465345a57e72353b672f8bcd3b845c3544dc63b9e
|
7
|
+
data.tar.gz: e46c5591f92b31f669be887730da8cd0ec9ec13daad649dad8d80ab7b5cc7baf299006e18c58ea3109a7defbc88788a5906b832653f27a57f01ee833cc337f2b
|
data/controller/init.rb
CHANGED
@@ -46,6 +46,17 @@ class Controller < Ramaze::Controller
|
|
46
46
|
@_traffic_server ||= ::TSAdmin::TrafficServer.new(APP_CONFIG['traffic_server'])
|
47
47
|
end
|
48
48
|
|
49
|
+
def restart_traffic_server
|
50
|
+
@@restart_scheduled = true
|
51
|
+
@@restart_thread = Thread.new do
|
52
|
+
while @@restart_scheduled
|
53
|
+
@@restart_scheduled = false
|
54
|
+
traffic_server.restart
|
55
|
+
end
|
56
|
+
@@restart_thread = nil
|
57
|
+
end if !defined?(@@restart_thread) || @@restart_thread.nil?
|
58
|
+
end
|
59
|
+
|
49
60
|
end
|
50
61
|
|
51
62
|
# Here you can require all your other controllers. Note that if you have multiple
|
data/controller/main.rb
CHANGED
@@ -4,7 +4,7 @@ class MainController < Controller
|
|
4
4
|
return unless login_required
|
5
5
|
|
6
6
|
external_ip_fallback = '<span class="none">none</span>'
|
7
|
-
@external_ip = (APP_CONFIG['info']['
|
7
|
+
@external_ip = (APP_CONFIG['info']['external_ip'] || external_ip_fallback) rescue external_ip_fallback
|
8
8
|
end
|
9
9
|
|
10
10
|
end
|
data/controller/remap.rb
CHANGED
@@ -16,7 +16,7 @@ class RemapController < Controller
|
|
16
16
|
@to = request[:to]
|
17
17
|
if traffic_server.add_remap(@type, @from, @to)
|
18
18
|
traffic_server.save
|
19
|
-
|
19
|
+
restart_traffic_server
|
20
20
|
flash[:info] = "Remap entry added"
|
21
21
|
call(r('/'))
|
22
22
|
else
|
@@ -39,7 +39,7 @@ class RemapController < Controller
|
|
39
39
|
@to = request[:to]
|
40
40
|
if traffic_server.edit_remap(@id, @from, @to)
|
41
41
|
traffic_server.save
|
42
|
-
|
42
|
+
restart_traffic_server
|
43
43
|
flash[:info] = "Remap entry updated"
|
44
44
|
call(r('/'))
|
45
45
|
else
|
@@ -61,7 +61,7 @@ class RemapController < Controller
|
|
61
61
|
|
62
62
|
traffic_server.delete_remap(request[:id])
|
63
63
|
traffic_server.save
|
64
|
-
|
64
|
+
restart_traffic_server
|
65
65
|
|
66
66
|
flash[:info] = "Remap entry removed"
|
67
67
|
|
@@ -71,10 +71,12 @@ module TSAdmin
|
|
71
71
|
own_config = ''
|
72
72
|
own_config << "#{marker_begin}\n"
|
73
73
|
redirects.each do |redirect|
|
74
|
-
|
74
|
+
options = redirect[:options] ? '' : ''
|
75
|
+
own_config << "redirect #{redirect[:from]} #{redirect[:to]} #{options}\n"
|
75
76
|
end
|
76
77
|
maps.each do |map|
|
77
|
-
|
78
|
+
options = map[:options] ? '' : ''
|
79
|
+
own_config << "map #{map[:from]} #{map[:to]} #{options}\n"
|
78
80
|
end
|
79
81
|
own_config << "#{marker_end}\n"
|
80
82
|
|
data/lib/ts-admin/version.rb
CHANGED