bbk-utils 1.1.2.294516 → 1.1.3.346360
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 +9 -9
- data/lib/bbk/utils/config.rb +4 -0
- data/lib/bbk/utils/env_helper.rb +19 -16
- data/lib/bbk/utils/version.rb +1 -1
- 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: c98de469175fc8869bdc1edd9edbe369cd8ad6565562ee8d02a1b1ae7feb1450
|
|
4
|
+
data.tar.gz: 9466e4ea6deef8077f3ab79c4093d18b414002da13bdab4281e1603117d7d4a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 872967896d893413dd99b224e62539aaaf3781160cf496ea00ef206407ea4369a2a5095bd7e4a516745322ba950fd33d684721971359b672b694416325a41ddd
|
|
7
|
+
data.tar.gz: c3c61b26a5916f4c4188a66082429011d15b714d716265220065f4cbcf5d5e670a7878096fe330e9a0a6bed6728accee612afab963610a98d19982b3da170070
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
bbk-utils (1.1.
|
|
4
|
+
bbk-utils (1.1.3.346360)
|
|
5
5
|
activesupport (>= 7.0)
|
|
6
6
|
russian
|
|
7
7
|
securerandom (~> 0.3.2)
|
|
@@ -9,7 +9,7 @@ PATH
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
activesupport (7.1.
|
|
12
|
+
activesupport (7.1.6)
|
|
13
13
|
base64
|
|
14
14
|
benchmark (>= 0.3)
|
|
15
15
|
bigdecimal
|
|
@@ -30,19 +30,19 @@ GEM
|
|
|
30
30
|
descendants_tracker (~> 0.0.4)
|
|
31
31
|
ice_nine (~> 0.11.0)
|
|
32
32
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
33
|
-
base64 (0.
|
|
34
|
-
benchmark (0.
|
|
35
|
-
bigdecimal (3.1
|
|
33
|
+
base64 (0.3.0)
|
|
34
|
+
benchmark (0.5.0)
|
|
35
|
+
bigdecimal (3.3.1)
|
|
36
36
|
byebug (11.1.3)
|
|
37
37
|
coercible (1.0.0)
|
|
38
38
|
descendants_tracker (~> 0.0.1)
|
|
39
39
|
concurrent-ruby (1.2.2)
|
|
40
|
-
connection_pool (2.5.
|
|
40
|
+
connection_pool (2.5.5)
|
|
41
41
|
descendants_tracker (0.0.4)
|
|
42
42
|
thread_safe (~> 0.3, >= 0.3.1)
|
|
43
43
|
diff-lcs (1.6.0)
|
|
44
44
|
docile (1.4.0)
|
|
45
|
-
drb (2.2.
|
|
45
|
+
drb (2.2.3)
|
|
46
46
|
equalizer (0.0.11)
|
|
47
47
|
erubis (2.7.0)
|
|
48
48
|
faker (2.19.0)
|
|
@@ -62,8 +62,8 @@ GEM
|
|
|
62
62
|
kwalify (0.7.2)
|
|
63
63
|
launchy (2.5.0)
|
|
64
64
|
addressable (~> 2.7)
|
|
65
|
-
logger (1.
|
|
66
|
-
minitest (5.
|
|
65
|
+
logger (1.7.0)
|
|
66
|
+
minitest (5.26.1)
|
|
67
67
|
mutex_m (0.3.0)
|
|
68
68
|
parallel (1.21.0)
|
|
69
69
|
parser (3.0.3.1)
|
data/lib/bbk/utils/config.rb
CHANGED
data/lib/bbk/utils/env_helper.rb
CHANGED
|
@@ -33,22 +33,24 @@ module BBK
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def self.build_uri_with_defaults(env, prefix: DEFAULT_DATABASE_PREFIX)
|
|
36
|
-
::URI.parse(env[prefixed_key(prefix, 'URL')] || '').
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
::URI.parse(env[prefixed_key(prefix, 'URL')] || '').then do |uri|
|
|
37
|
+
result = uri.clone
|
|
38
|
+
result.scheme = env.fetch(prefixed_key(prefix, 'ADAPTER'), uri.scheme) || 'postgresql'
|
|
39
|
+
result.hostname = env.fetch(prefixed_key(prefix, 'HOST'), uri.hostname) || 'db'
|
|
40
|
+
result.port = env.fetch(prefixed_key(prefix, 'PORT'), uri.port) || 5432
|
|
41
|
+
result.user = env.fetch(prefixed_key(prefix, 'USER'), uri.user) || 'postgres'
|
|
42
|
+
result.password = env.fetch(prefixed_key(prefix, 'PASS'), uri.password)
|
|
42
43
|
|
|
43
44
|
name = env.fetch(prefixed_key(prefix, 'NAME'), uri.path) || ''
|
|
44
45
|
name = "/#{name}" unless name.start_with?('/')
|
|
45
|
-
|
|
46
|
+
result.path = name
|
|
46
47
|
|
|
47
48
|
if uri.query
|
|
48
49
|
params = URI.decode_www_form(uri.query).to_h
|
|
49
50
|
params['pool'] = env.fetch(prefixed_key(prefix, 'POOL'), params['pool'])
|
|
50
|
-
|
|
51
|
+
result.query = URI.encode_www_form(params)
|
|
51
52
|
end
|
|
53
|
+
result
|
|
52
54
|
end
|
|
53
55
|
end
|
|
54
56
|
|
|
@@ -76,17 +78,19 @@ module BBK
|
|
|
76
78
|
URI.parse(url).hostname || 'mq').split(/[;|]/)].flatten.select(&:present?).uniq
|
|
77
79
|
|
|
78
80
|
hosts.map do |host|
|
|
79
|
-
URI.parse(url).
|
|
80
|
-
|
|
81
|
-
uri.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
URI.parse(url).then do |uri|
|
|
82
|
+
result = uri.clone
|
|
83
|
+
result.scheme = uri.scheme || 'amqps'
|
|
84
|
+
result.hostname = host
|
|
85
|
+
result.port = env.fetch('MQ_PORT', uri.port) || 5671
|
|
86
|
+
result.user = env.fetch('MQ_USER', uri.user)
|
|
87
|
+
result.password = env.fetch('MQ_PASS', uri.password)
|
|
85
88
|
|
|
86
89
|
vhost = [env.fetch('MQ_VHOST', uri.path), '/'].find(&:present?)
|
|
87
90
|
vhost = "/#{vhost}" unless vhost.start_with?('/')
|
|
88
91
|
|
|
89
|
-
|
|
92
|
+
result.path = vhost
|
|
93
|
+
result
|
|
90
94
|
end
|
|
91
95
|
end
|
|
92
96
|
end
|
|
@@ -107,7 +111,6 @@ module BBK
|
|
|
107
111
|
env['MQ_VHOST'] = vhost
|
|
108
112
|
end
|
|
109
113
|
|
|
110
|
-
|
|
111
114
|
def self.prefixed_key(prefix, name)
|
|
112
115
|
[prefix, name].select(&:present?).join('_')
|
|
113
116
|
end
|
data/lib/bbk/utils/version.rb
CHANGED
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.1.
|
|
4
|
+
version: 1.1.3.346360
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Samoilenko Yuri
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-12-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|