bbk-utils 1.0.1.72735 → 1.0.1.89770
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +4 -4
- data/README.md +6 -1
- data/lib/bbk/utils/env_helper.rb +13 -0
- data/lib/bbk/utils.rb +18 -0
- data/sig/bbk/env_helper.rbs +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9a7afa5a8879bb88c539dd0d11b2c4e57321cfb729de3bd5fe1e31d4becea87
|
4
|
+
data.tar.gz: d57ebc66b8468c354b0124dc3ada3eba12738b67863d3bab9010c562fdf8a8df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0adb7b4527d8bff9241d7c6bc7da35749cfbc872dcfc1cf1d68efb4752a4c479a950cf26da1a8dc9a2b68137f743fbc152fc9daa2e1887208663ec2683b0d6c
|
7
|
+
data.tar.gz: 22e33eac745da9ba63d698218013ce1621dd7a75e4a6ca63030e0566699ec8a206f144b0552fee4c1b0b7f8e6f9f502450cf2559f60514e66c8a19163cbc715a
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bbk-utils (1.0.1.
|
4
|
+
bbk-utils (1.0.1.89770)
|
5
5
|
activesupport (~> 6.0)
|
6
6
|
russian
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (6.1.
|
11
|
+
activesupport (6.1.6)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
13
|
i18n (>= 1.6, < 2)
|
14
14
|
minitest (>= 5.1)
|
@@ -49,7 +49,7 @@ GEM
|
|
49
49
|
kwalify (0.7.2)
|
50
50
|
launchy (2.5.0)
|
51
51
|
addressable (~> 2.7)
|
52
|
-
minitest (5.
|
52
|
+
minitest (5.16.2)
|
53
53
|
parallel (1.21.0)
|
54
54
|
parser (3.0.3.1)
|
55
55
|
ast (~> 2.4.1)
|
@@ -133,7 +133,7 @@ GEM
|
|
133
133
|
coercible (~> 1.0)
|
134
134
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
135
135
|
equalizer (~> 0.0, >= 0.0.9)
|
136
|
-
zeitwerk (2.
|
136
|
+
zeitwerk (2.6.0)
|
137
137
|
|
138
138
|
PLATFORMS
|
139
139
|
ruby
|
data/README.md
CHANGED
@@ -42,6 +42,11 @@ gem "bbk-utils", "~> 1.0.0"
|
|
42
42
|
* Ruby (MRI) 2.5.x
|
43
43
|
* Ruby (MRI) 3.0.x
|
44
44
|
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
See the file [CONTRIBUTING.md](./CONTRIBUTING.md)
|
48
|
+
|
45
49
|
## License
|
46
50
|
|
47
|
-
|
51
|
+
See the file [LICENSE](./LICENSE)
|
52
|
+
|
data/lib/bbk/utils/env_helper.rb
CHANGED
@@ -17,6 +17,19 @@ module BBK
|
|
17
17
|
env
|
18
18
|
end
|
19
19
|
|
20
|
+
def self.prepare_jaeger_envs(env)
|
21
|
+
jaeger_uri = ::URI.parse(env['JAEGER_URL'] || '').tap do |uri|
|
22
|
+
uri.scheme = env.fetch('JAEGER_SENDER', uri.scheme) || 'udp'
|
23
|
+
uri.hostname = env.fetch('JAEGER_HOST', uri.host) || 'jaeger'
|
24
|
+
uri.port = env.fetch('JAEGER_PORT', uri.port) || 6831
|
25
|
+
end
|
26
|
+
env['JAEGER_URL'] = jaeger_uri.to_s
|
27
|
+
env['JAEGER_SENDER'] = jaeger_uri.scheme
|
28
|
+
env['JAEGER_HOST'] = jaeger_uri.host
|
29
|
+
env['JAEGER_PORT'] = jaeger_uri.port.to_s
|
30
|
+
env
|
31
|
+
end
|
32
|
+
|
20
33
|
def self.build_uri_with_defaults(env)
|
21
34
|
::URI.parse(env['DATABASE_URL'] || '').tap do |uri|
|
22
35
|
uri.scheme = env.fetch('DATABASE_ADAPTER', uri.scheme) || 'postgresql'
|
data/lib/bbk/utils.rb
CHANGED
@@ -17,6 +17,24 @@ module BBK
|
|
17
17
|
|
18
18
|
attr_accessor :logger
|
19
19
|
|
20
|
+
def gracefully_main
|
21
|
+
yield
|
22
|
+
0
|
23
|
+
rescue SignalException => e
|
24
|
+
if %w[INT TERM EXIT QUIT].include?(Signal.signame(e.signo))
|
25
|
+
0
|
26
|
+
else
|
27
|
+
logger.error "Signal: #{e.inspect}"
|
28
|
+
1
|
29
|
+
end
|
30
|
+
rescue StandardError => e
|
31
|
+
logger.error "Exception: #{e.inspect}. Backtrace: #{e.backtrace.inspect}"
|
32
|
+
1
|
33
|
+
rescue SystemExit => e
|
34
|
+
logger.error "System exit: #{e.inspect}. Backtrace: #{e.backtrace.inspect}"
|
35
|
+
e.status
|
36
|
+
end
|
37
|
+
|
20
38
|
end
|
21
39
|
|
22
40
|
self.logger = ::BBK::Utils::Logger.default
|
data/sig/bbk/env_helper.rbs
CHANGED
@@ -4,6 +4,7 @@ module BBK
|
|
4
4
|
|
5
5
|
def self.prepare_database_envs: (Hash[String, untyped]|::_ENV env ) -> (Hash[String,untyped]|::_ENV)
|
6
6
|
def self.prepare_mq_envs: (Hash[String, untyped]|::_ENV env) -> (Hash[String, untyped]|::_ENV)
|
7
|
+
def self.prepare_jaeger_envs: (Hash[String, untyped]|::_ENV env) -> (Hash[String, untyped]|::_ENV)
|
7
8
|
def self.build_uri_with_defaults: (Hash[String, untyped]|::_ENV env) -> URI::Generic
|
8
9
|
def self.apply_env_from_uri: (Hash[String, untyped]|::_ENV env, URI::Generic uri) -> void
|
9
10
|
def self.build_mq_uri_with_defaults: (Hash[String, untyped]|::_ENV env) -> Array[URI::Generic]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bbk-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.1.
|
4
|
+
version: 1.0.1.89770
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samoilenko Yuri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|