clowder-common-ruby 0.4.3 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/clowder-common-ruby/rails_config.rb +27 -11
- data/lib/clowder-common-ruby/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: 2eb27069341b3726423c02088d23f56a4dcb659044ead344028da876a7dfb01a
|
4
|
+
data.tar.gz: d816b9eb821d8bb5a6841c804168dad27ff2627596a91fd5fc172d97ebc7178a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 591aaa8a7be6e2fbcc7119a74de0c94cb95d8dbce2555db27784d62d2245561824b77393d5b29028c43a6008165fa7eee8d572a5bc1adf017b0df776a36efa44
|
7
|
+
data.tar.gz: 1fcaf4ad4eefedd3cfbba5f00e2757a0d0c0a7fa47d3e0c53245d3ba50de8dea039363e72f72cceee30b68e5b3802e1681ca5ba24079e2739fbf3ba4027b76e8
|
@@ -16,6 +16,7 @@ module ClowderCommonRuby
|
|
16
16
|
database: configure_database(config),
|
17
17
|
prometheus_exporter_port: config&.metricsPort,
|
18
18
|
tls_ca_path: config.tlsCAPath,
|
19
|
+
unleash: configure_unleash(config),
|
19
20
|
web_port: config.webPort
|
20
21
|
}
|
21
22
|
end
|
@@ -23,18 +24,18 @@ module ClowderCommonRuby
|
|
23
24
|
# Short path for db config
|
24
25
|
def db_config
|
25
26
|
config = ClowderCommonRuby::Config.load
|
26
|
-
|
27
|
+
|
27
28
|
configure_database(config)
|
28
29
|
end
|
29
|
-
|
30
|
-
private
|
30
|
+
|
31
|
+
private
|
31
32
|
|
32
33
|
# Kafka configuration hash
|
33
34
|
def configure_kafka(config)
|
34
35
|
# In case there are no kafka brokers, an empty string is ensured in place of ':'
|
35
36
|
build_kafka_security(config).merge(
|
36
37
|
brokers: build_kafka_brokers(config) || '',
|
37
|
-
topics: build_kafka_topics(config)
|
38
|
+
topics: build_kafka_topics(config)
|
38
39
|
)
|
39
40
|
end
|
40
41
|
|
@@ -47,7 +48,7 @@ module ClowderCommonRuby
|
|
47
48
|
return { security_protocol: 'plaintext' } unless authtype
|
48
49
|
|
49
50
|
unless authtype == 'sasl'
|
50
|
-
raise "Unsupported Kafka security protocol '#{authtype}'"
|
51
|
+
raise "Unsupported Kafka security protocol '#{authtype}'"
|
51
52
|
end
|
52
53
|
|
53
54
|
{
|
@@ -62,13 +63,13 @@ module ClowderCommonRuby
|
|
62
63
|
|
63
64
|
# Gives location of ssl certificate and makes sure it exists
|
64
65
|
def build_kafka_certificate(cacert)
|
65
|
-
return unless cacert.present?
|
66
|
+
return unless cacert.present?
|
66
67
|
|
67
|
-
|
68
|
+
ssl_ca_location = Rails.root.join('tmp', 'kafka_ca.crt')
|
68
69
|
|
69
|
-
write_temporary_file(
|
70
|
+
write_temporary_file(ssl_ca_location, cacert)
|
70
71
|
|
71
|
-
|
72
|
+
ssl_ca_location
|
72
73
|
end
|
73
74
|
|
74
75
|
# Kafka brokers list
|
@@ -154,7 +155,22 @@ module ClowderCommonRuby
|
|
154
155
|
ssl_root_cert: build_database_certificate(config.database.rdsCa)
|
155
156
|
}
|
156
157
|
end
|
157
|
-
|
158
|
+
|
159
|
+
# Unleash configuration hash
|
160
|
+
def configure_unleash(config)
|
161
|
+
return {} unless config.featureFlags
|
162
|
+
|
163
|
+
{
|
164
|
+
url: URI::HTTP.build(
|
165
|
+
host: config.featureFlags.hostname,
|
166
|
+
port: config.featureFlags.port,
|
167
|
+
protocol: config.featureFlags.scheme,
|
168
|
+
path: '/api'
|
169
|
+
).to_s,
|
170
|
+
token: config.featureFlags.clientAccessToken
|
171
|
+
}
|
172
|
+
end
|
173
|
+
|
158
174
|
# Gives location of database ssl certificate and makes sure it exists
|
159
175
|
def build_database_certificate(rdsca)
|
160
176
|
return unless rdsca.present?
|
@@ -170,7 +186,7 @@ module ClowderCommonRuby
|
|
170
186
|
def write_temporary_file(path, content)
|
171
187
|
File.open(path, 'w') do |f|
|
172
188
|
f.write(content)
|
173
|
-
end unless File.exist?(path)
|
189
|
+
end unless File.exist?(path)
|
174
190
|
end
|
175
191
|
end
|
176
192
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clowder-common-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Red Hat Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a ruby interface for preparing Clowder variables.
|
14
14
|
email:
|