Sha256: 5a5dbbf4df6df8646bba8c0dd4b47664c4c4fffcb8ebfa2a947742f9a8b89c07

Contents?: true

Size: 1.06 KB

Versions: 19

Compression:

Stored size: 1.06 KB

Contents

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

  def self.env filter=''
    env = ENV.clone

    to_delete = (Marty::Config['DIAG_ENV_BLOCK'] || []).map(&:upcase) + [
      'SCRIPT_URI', 'SCRIPT_URL']

    to_obfus = (Marty::Config['DIAG_ENV_OBFUSCATE'] || []).map(&:upcase) + [
      'SECRET_KEY_BASE']

    to_block = (Marty::Config['DIAG_ENV_BLOCK_IF_INCL'] || []).map(&:upcase) + [
      'PASSWORD', 'DEBUG']

    to_delete.each{|k| env.delete(k)}

    to_obfus.each{|k| env[k] = env[k][0,4] if env[k]}

    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

19 entries across 19 versions & 1 rubygems

Version Path
marty-2.3.15 other/marty/diagnostic/environment_variables.rb
marty-2.3.14 other/marty/diagnostic/environment_variables.rb
marty-2.3.13 other/marty/diagnostic/environment_variables.rb
marty-2.3.12 other/marty/diagnostic/environment_variables.rb
marty-2.3.11 other/marty/diagnostic/environment_variables.rb
marty-2.3.10 other/marty/diagnostic/environment_variables.rb
marty-2.3.9 other/marty/diagnostic/environment_variables.rb
marty-2.3.8 other/marty/diagnostic/environment_variables.rb
marty-2.3.7 other/marty/diagnostic/environment_variables.rb
marty-2.3.5 other/marty/diagnostic/environment_variables.rb
marty-2.3.4 other/marty/diagnostic/environment_variables.rb
marty-2.1.5 other/marty/diagnostic/environment_variables.rb
marty-2.3.2 other/marty/diagnostic/environment_variables.rb
marty-2.3.1 other/marty/diagnostic/environment_variables.rb
marty-2.3.0 other/marty/diagnostic/environment_variables.rb
marty-2.1.4 other/marty/diagnostic/environment_variables.rb
marty-2.1.3 other/marty/diagnostic/environment_variables.rb
marty-2.1.2 other/marty/diagnostic/environment_variables.rb
marty-2.1.1 other/marty/diagnostic/environment_variables.rb