rack-auditor 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/rack/auditor.rb +10 -6
- data/rack-auditor.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWMwOGQ5NjU5ZWJlNWFlYWU1OWI0MTczZTYzODYzOGJkN2Q2ODZhZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzQxNjI5OTA3NjcxZWU2NDg3ZGU1YWI2MDczMjUzNjg0YjJkZDEwNQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Mzk2M2M0Y2NhMjhlZjdjODY0NzA2YWEyY2E2MWY0YTcyOTc2Mzg5MWQwZWU0
|
10
|
+
ZGExNzU5YTUyYzk4N2ZhYjFlZDhmZjI0NTM2ZmFlMzQ2Mzk2MGNiYjIzYzY2
|
11
|
+
OTA5MWM0YzZhYjgzYWUzN2Y3ZjBhNjUwMjQ5MDZkMzk5Nzc5NzA=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MjI4MDU2MmRlODExMjkzNzJlYWNkYWE4ZWVhYjEyYmZkODU5ZjY4MTVjMmE3
|
14
|
+
OGU0NDQxYTAwYjA4ZjlmNDBiZGJmNzJjZDRjMzc1MDNiNjFmNGNlNDkwMDYy
|
15
|
+
ZTU3YmY5ZGU2NjkxZTk5MmVjNWU0NzgxNzdlNzMxMDkxYzMxYTk=
|
data/lib/rack/auditor.rb
CHANGED
@@ -2,13 +2,19 @@ require 'httparty'
|
|
2
2
|
|
3
3
|
module Rack
|
4
4
|
class Auditor
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@
|
5
|
+
def initialize(app, options = {})
|
6
|
+
@app = app
|
7
|
+
@root_uri = options[:root_uri] || 'http://snowflake.dev/'
|
8
|
+
@dev_mode = options[:dev_mode] || false
|
9
9
|
end
|
10
10
|
|
11
11
|
def call(env)
|
12
|
+
audit(env) unless @dev_mode
|
13
|
+
|
14
|
+
@app.call(env)
|
15
|
+
end
|
16
|
+
|
17
|
+
def audit(env)
|
12
18
|
key = env['HTTP_X_API_KEY']
|
13
19
|
secret = env['HTTP_X_API_SECRET']
|
14
20
|
|
@@ -28,8 +34,6 @@ module Rack
|
|
28
34
|
when 504
|
29
35
|
error_code(504, 'System Down')
|
30
36
|
end
|
31
|
-
|
32
|
-
@app.call(env)
|
33
37
|
end
|
34
38
|
|
35
39
|
private
|
data/rack-auditor.gemspec
CHANGED