class ClowderCommonRuby::AppConfig

Attributes

database[RW]
endpoints[RW]
featureFlags[RW]
inMemoryDb[RW]
kafka[RW]
logging[RW]
objectStore[RW]
privateEndpoints[RW]

Public Class Methods

new(attributes) click to toggle source
Calls superclass method
# File lib/clowder-common-ruby/types.rb, line 15
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, {}))
  @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

Public Instance Methods

valid_keys() click to toggle source
# File lib/clowder-common-ruby/types.rb, line 40
def valid_keys
  [].tap do |keys|
    keys << :privatePort
    keys << :publicPort
    keys << :webPort
    keys << :metricsPort
    keys << :metricsPath
    keys << :logging
    keys << :kafka
    keys << :database
    keys << :objectStore
    keys << :inMemoryDb
    keys << :featureFlags
    keys << :endpoints
    keys << :privateEndpoints
  end
end