what 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
- data/example/what.yml +4 -0
- data/lib/what/server.rb +10 -6
- data/lib/what/version.rb +1 -1
- metadata +3 -3
data/example/what.yml
CHANGED
@@ -6,6 +6,10 @@ formatter: json
|
|
6
6
|
### Set the polling interval for all services, in seconds. (default: 10)
|
7
7
|
interval: 10
|
8
8
|
|
9
|
+
### Set an optional token that must be provided as a query string to retrieve
|
10
|
+
### status via HTTP.
|
11
|
+
# secret_token: il1k3tUr7l3z
|
12
|
+
|
9
13
|
### Specify paths containing custom modules to load, relative to this file.
|
10
14
|
module_paths:
|
11
15
|
- modules
|
data/lib/what/server.rb
CHANGED
@@ -6,12 +6,16 @@ module What
|
|
6
6
|
Monitor.go!
|
7
7
|
end
|
8
8
|
|
9
|
-
def call(
|
10
|
-
[
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
9
|
+
def call(env)
|
10
|
+
if Config['secret_token'] && Config['secret_token'] != env['QUERY_STRING']
|
11
|
+
[403, {'Content-Type' => 'text/plain'}, "403 Forbidden\n"]
|
12
|
+
else
|
13
|
+
[
|
14
|
+
Status['health'] != 'alert' ? 200 : 503,
|
15
|
+
{'Content-Type' => Formatter.mime},
|
16
|
+
Formatter.format(Status.all)
|
17
|
+
]
|
18
|
+
end
|
15
19
|
end
|
16
20
|
end
|
17
21
|
end
|
data/lib/what/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: what
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 16
|
10
|
+
version: 0.0.16
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Fitzgerald
|