Sha256: ece3bc587c4506bbb1abf0a12794bbdd5dbec122162f0e5271bb7d3dde4a7c37

Contents?: true

Size: 1.55 KB

Versions: 19

Compression:

Stored size: 1.55 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_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
          }.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

19 entries across 19 versions & 3 rubygems

Version Path
wd_newrelic_rpm-3.5.8 lib/new_relic/agent/configuration/environment_source.rb
sundawg_newrelic_rpm-3.5.8.2 lib/new_relic/agent/configuration/environment_source.rb
sundawg_newrelic_rpm-3.5.8.1 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.8.72 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.8.70 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.8.64.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.7.59 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.7.59.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.7.58.beta lib/new_relic/agent/configuration/environment_source.rb
wd_newrelic_rpm-3.5.6 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.7.57.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.6.55 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.6.48.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.6.46.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.6.42.beta lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.5.39.beta lib/new_relic/agent/configuration/environment_source.rb
wd_newrelic_rpm-3.5.5 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.5.38 lib/new_relic/agent/configuration/environment_source.rb
newrelic_rpm-3.5.5.540.dev lib/new_relic/agent/configuration/environment_source.rb