Class: Inventory::Server::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/inventory/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cli_config) ⇒ Server

Returns a new instance of Server.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/inventory/server.rb', line 12

def initialize(cli_config)
  config = Config.generate(cli_config)
  @config = config

  InventoryLogger.setup(config[:logger])
  InventoryLogger.logger.level = config[:log_level]

  # Dynamically load plugins from plugins_path
  plugin_names = config[:plugins]
  @middlewares = Middleware::Builder.new do
    plugins = Loader.new(config).load_plugins(*plugin_names)
    plugins.each {|klass|
      use klass, config
    }
  end
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/inventory/server.rb', line 10

def config
  @config
end

#middlewaresObject (readonly)

Returns the value of attribute middlewares.



10
11
12
# File 'lib/inventory/server.rb', line 10

def middlewares
  @middlewares
end