Sha256: aa386212d7bae8bc63c23c7da12d27a1403826d308316da865b5cef526ddfb29

Contents?: true

Size: 981 Bytes

Versions: 11

Compression:

Stored size: 981 Bytes

Contents

module Marty::Diagnostic; class EnvironmentVariables < Base
  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

  def self.generate
    pack do
      env
    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
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
marty-1.2.9 other/marty/diagnostic/environment_variables.rb
marty-1.2.8 other/marty/diagnostic/environment_variables.rb
marty-1.2.7 other/marty/diagnostic/environment_variables.rb
marty-1.2.6 other/marty/diagnostic/environment_variables.rb
marty-1.2.5 other/marty/diagnostic/environment_variables.rb
marty-1.2.4 other/marty/diagnostic/environment_variables.rb
marty-1.2.3 other/marty/diagnostic/environment_variables.rb
marty-1.2.2 other/marty/diagnostic/environment_variables.rb
marty-1.2.1 app/models/marty/diagnostic/environment_variables.rb
marty-1.2.0 app/models/marty/diagnostic/environment_variables.rb
marty-1.1.9 app/models/marty/diagnostic/environment_variables.rb