Class: AppInsights::ConfigLoader
- Inherits:
-
Object
- Object
- AppInsights::ConfigLoader
- Defined in:
- lib/appinsights/config_loader.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
-
#initialize(root, filename = nil) ⇒ ConfigLoader
constructor
A new instance of ConfigLoader.
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
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
5 6 7 |
# File 'lib/appinsights/config_loader.rb', line 5 def filename @filename end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
5 6 7 |
# File 'lib/appinsights/config_loader.rb', line 5 def settings @settings end |