Class: ClowderCommonRuby::AppConfig
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- ClowderCommonRuby::AppConfig
- Defined in:
- lib/clowder-common-ruby/types.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#database ⇒ Object
Returns the value of attribute database.
-
#endpoints ⇒ Object
Returns the value of attribute endpoints.
-
#featureFlags ⇒ Object
Returns the value of attribute featureFlags.
-
#inMemoryDb ⇒ Object
Returns the value of attribute inMemoryDb.
-
#kafka ⇒ Object
Returns the value of attribute kafka.
-
#logging ⇒ Object
Returns the value of attribute logging.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#objectStore ⇒ Object
Returns the value of attribute objectStore.
-
#privateEndpoints ⇒ Object
Returns the value of attribute privateEndpoints.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ AppConfig
constructor
A new instance of AppConfig.
- #valid_keys ⇒ Object
Constructor Details
#initialize(attributes) ⇒ AppConfig
Returns a new instance of AppConfig.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/clowder-common-ruby/types.rb', line 16 def initialize(attributes) super raise 'The input argument (attributes) must be a hash' if (!attributes || !attributes.is_a?(Hash)) attributes = attributes.each_with_object({}) do |(k, v), h| warn "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym) h[k.to_sym] = v end @logging = LoggingConfig.new(attributes.fetch(:logging, {})) @metadata = AppMetadata.new(attributes.fetch(:metadata, {})) @kafka = KafkaConfig.new(attributes.fetch(:kafka, {})) @database = DatabaseConfig.new(attributes.fetch(:database, {})) @objectStore = ObjectStoreConfig.new(attributes.fetch(:objectStore, {})) @inMemoryDb = InMemoryDBConfig.new(attributes.fetch(:inMemoryDb, {})) @featureFlags = FeatureFlagsConfig.new(attributes.fetch(:featureFlags, {})) @endpoints = [] attributes.fetch(:endpoints, []).each do |attr| @endpoints << DependencyEndpoint.new(attr) end @privateEndpoints = [] attributes.fetch(:privateEndpoints, []).each do |attr| @privateEndpoints << PrivateDependencyEndpoint.new(attr) end end |
Instance Attribute Details
#database ⇒ Object
Returns the value of attribute database.
9 10 11 |
# File 'lib/clowder-common-ruby/types.rb', line 9 def database @database end |
#endpoints ⇒ Object
Returns the value of attribute endpoints.
13 14 15 |
# File 'lib/clowder-common-ruby/types.rb', line 13 def endpoints @endpoints end |
#featureFlags ⇒ Object
Returns the value of attribute featureFlags.
12 13 14 |
# File 'lib/clowder-common-ruby/types.rb', line 12 def featureFlags @featureFlags end |
#inMemoryDb ⇒ Object
Returns the value of attribute inMemoryDb.
11 12 13 |
# File 'lib/clowder-common-ruby/types.rb', line 11 def inMemoryDb @inMemoryDb end |
#kafka ⇒ Object
Returns the value of attribute kafka.
8 9 10 |
# File 'lib/clowder-common-ruby/types.rb', line 8 def kafka @kafka end |
#logging ⇒ Object
Returns the value of attribute logging.
6 7 8 |
# File 'lib/clowder-common-ruby/types.rb', line 6 def logging @logging end |
#metadata ⇒ Object
Returns the value of attribute metadata.
7 8 9 |
# File 'lib/clowder-common-ruby/types.rb', line 7 def @metadata end |
#objectStore ⇒ Object
Returns the value of attribute objectStore.
10 11 12 |
# File 'lib/clowder-common-ruby/types.rb', line 10 def objectStore @objectStore end |
#privateEndpoints ⇒ Object
Returns the value of attribute privateEndpoints.
14 15 16 |
# File 'lib/clowder-common-ruby/types.rb', line 14 def privateEndpoints @privateEndpoints end |
Instance Method Details
#valid_keys ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/clowder-common-ruby/types.rb', line 42 def valid_keys [].tap do |keys| keys << :privatePort keys << :publicPort keys << :webPort keys << :tlsCAPath keys << :metricsPort keys << :metricsPath keys << :logging keys << :metadata keys << :kafka keys << :database keys << :objectStore keys << :inMemoryDb keys << :featureFlags keys << :endpoints keys << :privateEndpoints keys << :BOPURL keys << :hashCache end end |