clowder-common-ruby 0.4.3 → 0.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a05f119cf6a123acfb8155610f67c5231628fd8228b81298fc414f44ea2dd583
4
- data.tar.gz: d30ea93dea72be960b8ebafb9013ccbd48313a705af17db1bfdfa86d14dffe46
3
+ metadata.gz: 2eb27069341b3726423c02088d23f56a4dcb659044ead344028da876a7dfb01a
4
+ data.tar.gz: d816b9eb821d8bb5a6841c804168dad27ff2627596a91fd5fc172d97ebc7178a
5
5
  SHA512:
6
- metadata.gz: 024de310bf5780c99af49baa20e91a468b28b5b55521a1517569aa208d9398365bfd25dacd91fdc32994adfb7b6fdc676c7f3e8fcde0851c336ed2c01b9ed418
7
- data.tar.gz: 8e90789beff7f331c58ca417c832d21cfb89f4d1f2d9e35dc07dc038f3b0c9f0e482d956efdedfedf6191db3bc441f05136b888609fe19899f0a8a99ff280cd4
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
- kafka_config[:ssl_ca_location] = Rails.root.join('tmp', 'kafka_ca.crt')
68
+ ssl_ca_location = Rails.root.join('tmp', 'kafka_ca.crt')
68
69
 
69
- write_temporary_file(kafka_config[:ssl_ca_location], cacert)
70
+ write_temporary_file(ssl_ca_location, cacert)
70
71
 
71
- kafka_config[:ssl_ca_location]
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
@@ -1,3 +1,3 @@
1
1
  module ClowderCommonRuby
2
- VERSION = '0.4.3'.freeze # Patch version is being automatically bumped
2
+ VERSION = '0.5.1'.freeze # Patch version is being automatically bumped
3
3
  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.3
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-09-22 00:00:00.000000000 Z
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: