Class: AppInsights::BaseInstaller

Inherits:
Object
  • Object
show all
Defined in:
lib/appinsights/installers/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, root, filename = nil, logger = nil) ⇒ BaseInstaller



5
6
7
# File 'lib/appinsights/installers/base.rb', line 5

def initialize(app, root, filename = nil, logger = nil)
  @app, @root, @filename, @logger = app, root, filename, logger
end

Instance Attribute Details

#appObject

Returns the value of attribute app.



3
4
5
# File 'lib/appinsights/installers/base.rb', line 3

def app
  @app
end

#filenameObject

Returns the value of attribute filename.



3
4
5
# File 'lib/appinsights/installers/base.rb', line 3

def filename
  @filename
end

#loggerObject

Returns the value of attribute logger.



3
4
5
# File 'lib/appinsights/installers/base.rb', line 3

def logger
  @logger
end

#rootObject

Returns the value of attribute root.



3
4
5
# File 'lib/appinsights/installers/base.rb', line 3

def root
  @root
end

Instance Method Details

#installObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/appinsights/installers/base.rb', line 9

def install
  AppInsights::ConfigLoader.new @root, @filename

  AppInsights::Middlewares.enabled.each do |middleware, args|
    @app.use middleware, *args.values
  end
rescue AppInsights::ConfigFileNotFound => e
  logger.error e.message
  logger.info config_file_not_found_message
end