clowder-common-ruby 0.5.0 → 0.5.2
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/bin/ruby_class_converter.rb +12 -5
- data/bin/schema.json +9 -1
- data/lib/clowder-common-ruby/rails_config.rb +16 -0
- data/lib/clowder-common-ruby/types.rb +6 -0
- 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: 5f5724ba3decfd80d5680e28006c976a72bd03868586b0afd0d16415f2d30ca7
|
4
|
+
data.tar.gz: 14e7f2f3882001c06ee7391dad86f73269b2ad315691612827120bef7f228e02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fcf609b925a9d9de2fd8654e9effd592a6476bced6395acb745b7179bed5235e9b41ab7ca969f5538f57ac5c83369410f1b6a30753417127b4f75455c2c916b
|
7
|
+
data.tar.gz: d9dae30e257647850eadff44027175855ca17c9a65775422285726b373fc4dc315ca3d94271d3f74fbe2b71123df850246402844e69b3a0d49a1a6eab28a8c5d
|
data/bin/ruby_class_converter.rb
CHANGED
@@ -82,11 +82,18 @@ class RubyClassConverter
|
|
82
82
|
init_function << "\n"
|
83
83
|
value.properties.each_pair do |k, v|
|
84
84
|
if v.send(:type) == "array"
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
85
|
+
if v.items.send("$ref")
|
86
|
+
klass = v.items.send("$ref").rpartition('/').last
|
87
|
+
init_function << " @#{k} = []\n"
|
88
|
+
init_function << " attributes.fetch(:#{k.to_sym}, []).each do |attr|\n"
|
89
|
+
init_function << " @#{k} << #{klass}.new(attr)\n"
|
90
|
+
init_function << " end\n"
|
91
|
+
else
|
92
|
+
init_function << " @#{k} = []\n"
|
93
|
+
init_function << " attributes.fetch(:#{k.to_sym}, []).each do |attr|\n"
|
94
|
+
init_function << " @#{k} << attr\n"
|
95
|
+
init_function << " end\n"
|
96
|
+
end
|
90
97
|
elsif v.send('$ref')
|
91
98
|
klass = v.send('$ref').rpartition('/').last
|
92
99
|
init_function << " @#{k} = #{klass}.new(attributes.fetch(:#{k.to_sym}, {}))\n"
|
data/bin/schema.json
CHANGED
@@ -482,7 +482,15 @@
|
|
482
482
|
"type": "integer"
|
483
483
|
},
|
484
484
|
"apiPath": {
|
485
|
-
"description": "The top level api path that the app should serve from /api/<apiPath>"
|
485
|
+
"description": "The top level api path that the app should serve from /api/<apiPath> (deprecated, use apiPaths)",
|
486
|
+
"type": "string"
|
487
|
+
},
|
488
|
+
"apiPaths": {
|
489
|
+
"description": "The list of API paths (each matching format: '/api/some-path/') that this app will serve requests from",
|
490
|
+
"type": "array",
|
491
|
+
"items": {
|
492
|
+
"type": "string"
|
493
|
+
}
|
486
494
|
}
|
487
495
|
},
|
488
496
|
"required": [
|
@@ -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
|
@@ -155,6 +156,21 @@ module ClowderCommonRuby
|
|
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?
|
@@ -390,6 +390,7 @@ module ClowderCommonRuby
|
|
390
390
|
end
|
391
391
|
|
392
392
|
class DependencyEndpoint < OpenStruct
|
393
|
+
attr_accessor :apiPaths
|
393
394
|
|
394
395
|
def initialize(attributes)
|
395
396
|
super
|
@@ -400,6 +401,10 @@ module ClowderCommonRuby
|
|
400
401
|
h[k.to_sym] = v
|
401
402
|
end
|
402
403
|
|
404
|
+
@apiPaths = []
|
405
|
+
attributes.fetch(:apiPaths, []).each do |attr|
|
406
|
+
@apiPaths << attr
|
407
|
+
end
|
403
408
|
end
|
404
409
|
|
405
410
|
def valid_keys
|
@@ -410,6 +415,7 @@ module ClowderCommonRuby
|
|
410
415
|
keys << :app
|
411
416
|
keys << :tlsPort
|
412
417
|
keys << :apiPath
|
418
|
+
keys << :apiPaths
|
413
419
|
end
|
414
420
|
end
|
415
421
|
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.5.
|
4
|
+
version: 0.5.2
|
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-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This is a ruby interface for preparing Clowder variables.
|
14
14
|
email:
|