Sha256: 386cbe8b71ba5f00b1d7fb2ae15064c6735c62c96fe45fdaa46ac0cd836f97a4

Contents?: true

Size: 1.84 KB

Versions: 8

Compression:

Stored size: 1.84 KB

Contents

module NewRelic
  module Agent
    module Configuration
      class EnvironmentSource < DottedHash
        def initialize
          string_map = {
            'NRCONFIG'              => :config_path,
            'NEW_RELIC_LICENSE_KEY' => :license_key,
            'NEWRELIC_LICENSE_KEY'  => :license_key,
            'NEW_RELIC_APP_NAME'    => :app_name,
            'NEWRELIC_APP_NAME'     => :app_name,
            'NEW_RELIC_DISPATCHER'  => :dispatcher,
            'NEWRELIC_DISPATCHER'   => :dispatcher,
            'NEW_RELIC_FRAMEWORK'   => :framework,
            'NEWRELIC_FRAMEWORK'    => :framework
          }.each do |key, val|
            self[val] = ENV[key] if ENV[key]
          end

          boolean_map = {
            'NEWRELIC_ENABLE' => :agent_enabled
          }.each do |key, val|
            if ENV[key].to_s =~ /false|off|no/i
              self[val] = false
            elsif ENV[key] != nil
              self[val] = true
            end
          end

          if ENV['NEW_RELIC_LOG']
            if ENV['NEW_RELIC_LOG'].upcase == 'STDOUT'
              self[:log_file_path] = self[:log_file_name] = 'STDOUT'
            else
              self[:log_file_path] = File.dirname(ENV['NEW_RELIC_LOG'])
              self[:log_file_name] = File.basename(ENV['NEW_RELIC_LOG'])
            end
          end

          initialize_thread_profiler_settings
        end


        def initialize_thread_profiler_settings
          thread_profiler_supported = NewRelic::Agent::ThreadProfiler.is_supported?
          self[:'thread_profiler.is_supported'] = thread_profiler_supported

          # If not supporting thread profiling, ignore all other enabled's.
          # Otherwise, don't set so defaulting is heeded.
          if !thread_profiler_supported
            self[:'thread_profiler.enabled'] = false
          end
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
newrelic_rpm-3.5.4.35.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.4.34 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.4.33 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.4.31.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.4.29.beta lib/new_relic/agent/configuration/environment_source.rb
ghazel-newrelic_rpm-3.5.4 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.3.25 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.3.24 lib/new_relic/agent/configuration/environment_source.rb