Sha256: 45d77a751d7437b373c3bed0e39e4ab84f7177374406b0923f26fc394190c6d5

Contents?: true

Size: 994 Bytes

Versions: 3

Compression:

Stored size: 994 Bytes

Contents

class Diagnostic::Env < Diagnostic::Base
  def self.environment_variables filter=''
    env = ENV.clone

    # obfuscate SECRET_KEY_BASE for comparison
    env['SECRET_KEY_BASE'] = env['SECRET_KEY_BASE'][0,4] if
      env['SECRET_KEY_BASE']

    # remove SCRIPT_URI, SCRIPT_URL as calling node differs
    ['SCRIPT_URI', 'SCRIPT_URL'].each{|k| env.delete(k)}

    to_block = ['PASSWORD', 'DEBUG']
    env.sort.each_with_object({}){|(k,v),h|
      h[k] = v if to_block.all?{|b| !k.include?(b)} && k.include?(filter)}
  end

  def self.generate
    pack do
      environment_variables
    end
  end

  # overwritten to only return inconsitent data
  def self.apply_consistency data
    diff = get_difference(data)
    data.each_with_object({}){
      |(node, diagnostic), new_data|
      new_data[node] = diagnostic.each_with_object({}){
        |(test, info), new_diagnostic|
        new_diagnostic[test] = info + {'consistent' => false} if
          diff.include?(test)
      }
    }
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
marty-1.1.8 app/models/diagnostic/env.rb
marty-1.1.7 app/models/diagnostic/env.rb
marty-1.1.6 app/models/diagnostic/env.rb