bbk-utils 1.0.1.72916 → 1.0.1.93642
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +5 -7
- 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 +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0cbd3ef94543f7d959795c36ac3da87c82ddb206b76caea9c9e346f6397eb47
|
4
|
+
data.tar.gz: d5e7333ad1c1d5cb3257ee72439dad699943def60f5ad6fcc293e705a32854d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59e943a64751d2128141a00ac0f9a7003ec7797dbdd8da0358f5bf6f19c20ee572a85c211d80633840cc23edef971cad0f6fbf471fdae5475b39d31b7f3fd9c9
|
7
|
+
data.tar.gz: 7f0c7a20f9308973b85ce992b1f4fd0f21f1bb66f0043a9eac0b2b84a125d49ca7d20b059c71e16889ca3426a249ab3c077e9eb98f424d6178a95edebae58d47
|
data/Gemfile.lock
CHANGED
@@ -1,19 +1,18 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bbk-utils (1.0.1.
|
5
|
-
activesupport (
|
4
|
+
bbk-utils (1.0.1.93642)
|
5
|
+
activesupport (>= 6.0)
|
6
6
|
russian
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (
|
11
|
+
activesupport (7.0.3.1)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
13
|
i18n (>= 1.6, < 2)
|
14
14
|
minitest (>= 5.1)
|
15
15
|
tzinfo (~> 2.0)
|
16
|
-
zeitwerk (~> 2.3)
|
17
16
|
addressable (2.8.0)
|
18
17
|
public_suffix (>= 2.0.2, < 5.0)
|
19
18
|
ansi (1.5.0)
|
@@ -49,7 +48,7 @@ GEM
|
|
49
48
|
kwalify (0.7.2)
|
50
49
|
launchy (2.5.0)
|
51
50
|
addressable (~> 2.7)
|
52
|
-
minitest (5.
|
51
|
+
minitest (5.16.3)
|
53
52
|
parallel (1.21.0)
|
54
53
|
parser (3.0.3.1)
|
55
54
|
ast (~> 2.4.1)
|
@@ -125,7 +124,7 @@ GEM
|
|
125
124
|
unicode-display_width (>= 1.1.1, < 3)
|
126
125
|
thread_safe (0.3.6)
|
127
126
|
tty-which (0.4.2)
|
128
|
-
tzinfo (2.0.
|
127
|
+
tzinfo (2.0.5)
|
129
128
|
concurrent-ruby (~> 1.0)
|
130
129
|
unicode-display_width (2.1.0)
|
131
130
|
virtus (1.0.5)
|
@@ -133,7 +132,6 @@ GEM
|
|
133
132
|
coercible (~> 1.0)
|
134
133
|
descendants_tracker (~> 0.0, >= 0.0.3)
|
135
134
|
equalizer (~> 0.0, >= 0.0.9)
|
136
|
-
zeitwerk (2.5.3)
|
137
135
|
|
138
136
|
PLATFORMS
|
139
137
|
ruby
|
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,27 +1,27 @@
|
|
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.93642
|
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-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '6.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '6.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|