Class: AppInsights::ConfigLoader

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root, filename = nil) ⇒ ConfigLoader

Returns a new instance of ConfigLoader.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/appinsights/config_loader.rb', line 7

def initialize(root, filename = nil)
  @root = root
  @filename = filename || default_file
  @filename = File.join(@root, @filename) if @filename

  unless @filename && File.exist?(@filename)
    fail AppInsights::ConfigFileNotFound
  end

  @settings = TOML.load_file @filename

  AppInsights::Context.configure @settings['ai']
  AppInsights::Middlewares.configure @settings['middleware']
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



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

def filename
  @filename
end

#settingsObject (readonly)

Returns the value of attribute settings.



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

def settings
  @settings
end