kubelink 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kubelink/sentry.rb +14 -15
- data/lib/kubelink/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebe01e105678e63dae11e3d45728ff797e474abefcbb2fb8c098ba9d09e70ca5
|
4
|
+
data.tar.gz: '08651159712216d8ee4e3abdfa471616904a72a5c1ef9eceed977f08d8a63ca5'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a91493aec8df9e12aa40b3a51bb6c99c25c9d79dbf965cec526404e52bc0360ef7f7f392fc491636a579a5d9c49f81e4d70d048ce9f191228114ec8faabff656
|
7
|
+
data.tar.gz: d0985050e630df6cf30cf81e62ed6dcbd2a37bbbcc5eb707ab4d81a36427d2a1bc586d248517e968599045a223fd893d9abba98addbd8faff2450926d810293b
|
data/lib/kubelink/sentry.rb
CHANGED
@@ -1,16 +1,26 @@
|
|
1
1
|
module Kubelink
|
2
2
|
class Sentry < Rails::Railtie
|
3
|
+
def self.sentry_dsn
|
4
|
+
@dsn ||= begin
|
5
|
+
u = URI.parse(ENV['SENTRY_DSN'])
|
6
|
+
u.password = nil
|
7
|
+
u.to_s
|
8
|
+
rescue
|
9
|
+
nil
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
3
13
|
initializer "kubelink.sentry_integration" do
|
4
14
|
ActiveSupport.on_load :action_view do
|
5
15
|
include Helpers
|
6
16
|
end
|
7
17
|
|
8
|
-
if
|
18
|
+
if Sentry.sentry_dsn
|
9
19
|
require 'raven'
|
10
20
|
|
11
21
|
Raven.configure do |config|
|
12
|
-
config.dsn =
|
13
|
-
config.release = ENV['RAILS_COMMIT']
|
22
|
+
config.dsn = Sentry.sentry_dsn
|
23
|
+
config.release = ENV['RAILS_COMMIT'] if ENV.key?('RAILS_COMMIT')
|
14
24
|
end
|
15
25
|
|
16
26
|
ActiveSupport.on_load :action_controller do
|
@@ -22,16 +32,6 @@ module Kubelink
|
|
22
32
|
end
|
23
33
|
|
24
34
|
module Helpers
|
25
|
-
def sentry_dsn
|
26
|
-
@dsn ||= begin
|
27
|
-
u = URI.parse(ENV['SENTRY_DSN'])
|
28
|
-
u.password = nil
|
29
|
-
u.to_s
|
30
|
-
rescue
|
31
|
-
nil
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
35
|
def sentry_include_tag
|
36
36
|
return unless sentry_dsn.present?
|
37
37
|
|
@@ -39,7 +39,7 @@ module Kubelink
|
|
39
39
|
|
40
40
|
[ javascript_include_tag(script, crossorigin: :anonymous),
|
41
41
|
javascript_tag(nonce: true) do
|
42
|
-
%Q{Sentry.init({ dsn: "#{sentry_dsn}" });}.html_safe
|
42
|
+
%Q{Sentry.init({ dsn: "#{Sentry.sentry_dsn}" });}.html_safe
|
43
43
|
end
|
44
44
|
].join("\n").html_safe
|
45
45
|
end
|
@@ -53,7 +53,6 @@ module Kubelink
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def set_raven_context
|
56
|
-
return unless helpers.sentry_dsn
|
57
56
|
Raven.extra_context(params: params.dup.permit!.to_hash, url: request.url)
|
58
57
|
Raven.user_context(ip_address: request.remote_ip)
|
59
58
|
end
|
data/lib/kubelink/version.rb
CHANGED