Sha256: ec72e1539a84e0c9cfaa9894c2193a34d540e647b1cf4e31f94df2261ab25e65

Contents?: true

Size: 958 Bytes

Versions: 11

Compression:

Stored size: 958 Bytes

Contents

module Marty::Diagnostic; class EnvironmentVariables < Base
  diagnostic_fn do
    env
  end

  def self.env 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

  # 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
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
marty-2.1.0 other/marty/diagnostic/environment_variables.rb
marty-2.0.9 other/marty/diagnostic/environment_variables.rb
marty-2.0.8 other/marty/diagnostic/environment_variables.rb
marty-2.0.7 other/marty/diagnostic/environment_variables.rb
marty-2.0.6 other/marty/diagnostic/environment_variables.rb
marty-2.0.5 other/marty/diagnostic/environment_variables.rb
marty-2.0.4 other/marty/diagnostic/environment_variables.rb
marty-2.0.3 other/marty/diagnostic/environment_variables.rb
marty-2.0.2 other/marty/diagnostic/environment_variables.rb
marty-2.0.1 other/marty/diagnostic/environment_variables.rb
marty-2.0.0 other/marty/diagnostic/environment_variables.rb