Sha256: aa7c2af2da040f33e77d7e45477f4139b25650d9c2702a29f5b55b65b4c7bff5

Contents?: true

Size: 1.85 KB

Versions: 14

Compression:

Stored size: 1.85 KB

Contents

# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

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_HOST'        => :host,
            'NEW_RELIC_PORT'        => :port
          }.each do |key, val|
            self[val] = ENV[key] if ENV[key]
          end

          symbol_map = {
            'NEW_RELIC_DISPATCHER'  => :dispatcher,
            'NEWRELIC_DISPATCHER'   => :dispatcher,
            'NEW_RELIC_FRAMEWORK'   => :framework,
            'NEWRELIC_FRAMEWORK'    => :framework
          }.each do |key, val|
            self[val] = ENV[key].intern if ENV[key]
          end

          boolean_map = {
            'NEWRELIC_ENABLE' => :agent_enabled,
            'NEWRELIC_ENABLED' => :agent_enabled,
            'NEW_RELIC_ENABLE' => :agent_enabled,
            'NEW_RELIC_ENABLED' => :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
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
newrelic_rpm-3.6.5.130 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.4.122 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.4.113.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.3.111 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.3.106 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.3.105.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.3.104 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.3.103.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.2.96 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.2.90.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.1.88 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.1.87 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.1.86.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.6.1.85.beta lib/new_relic/agent/configuration/environment_source.rb