lib/bmc-daemon-lib/conf.rb in bmc-daemon-lib-0.2.0 vs lib/bmc-daemon-lib/conf.rb in bmc-daemon-lib-0.3.0
- old
+ new
@@ -79,11 +79,13 @@
# Set up encodings
Encoding.default_internal = "utf-8"
Encoding.default_external = "utf-8"
# Init New Relic
- newrelic_logfile = File.expand_path(Conf[:logs][:newrelic].to_s, Conf[:logs][:path].to_s)
+ logs_newrelic = Conf.at :logs, :newrelic
+ logs_path = Conf.at :logs, :path
+ newrelic_logfile = File.expand_path logs_newrelic.to_s, logs_path.to_s
prepare_newrelic self[:newrelic], newrelic_logfile
# Try to access any key to force parsing of the files
self[:dummy]
@@ -169,19 +171,18 @@
ENV["NEW_RELIC_LOG"] = logfile.to_s if logfile
ENV["NEW_RELIC_LICENSE_KEY"] = section[:license].to_s
ENV["NEW_RELIC_MONITOR_MODE"] = "true"
# Build NewRelic app_name if not provided as-is
- if section[:app_name]
- ENV["NEW_RELIC_APP_NAME"] = section[:app_name].to_s
- else
+ if !section[:app_name]
stack = []
stack << (section[:prefix] || @app_name)
stack << section[:platform] if section[:platform]
stack << @app_env
text = stack.join('-')
- ENV["NEW_RELIC_APP_NAME"] = "#{text}-#{host};#{text}"
+ section[:app_name] = "#{text}; #{text}-#{host}"
end
+ ENV["NEW_RELIC_APP_NAME"] = section[:app_name].to_s
# Enable module
ENV["NEWRELIC_AGENT_ENABLED"] = "true"
end