Sha256: c75a434752c0779b5da01036cf6761280931e7f477207df178d2a950cb885034

Contents?: true

Size: 1.11 KB

Versions: 44

Compression:

Stored size: 1.11 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) + [
      'ACCESS', 'SECRET', '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({}) do |(k, v), h|
      h[k] = v if to_block.all? { |b| !k.include?(b) } && k.include?(filter)
    end
  end

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

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
marty-9.5.1 lib/marty/diagnostic/environment_variables.rb
marty-9.5.0 lib/marty/diagnostic/environment_variables.rb
marty-9.3.3 lib/marty/diagnostic/environment_variables.rb
marty-9.3.2 lib/marty/diagnostic/environment_variables.rb
marty-9.3.0 lib/marty/diagnostic/environment_variables.rb
marty-8.5.0 lib/marty/diagnostic/environment_variables.rb
marty-8.4.1 lib/marty/diagnostic/environment_variables.rb
marty-8.3.1 lib/marty/diagnostic/environment_variables.rb
marty-8.2.0 lib/marty/diagnostic/environment_variables.rb
marty-8.0.0 lib/marty/diagnostic/environment_variables.rb
marty-6.1.0 lib/marty/diagnostic/environment_variables.rb
marty-5.2.0 other/marty/diagnostic/environment_variables.rb
marty-5.1.4 other/marty/diagnostic/environment_variables.rb
marty-5.1.3 other/marty/diagnostic/environment_variables.rb
marty-5.1.2 other/marty/diagnostic/environment_variables.rb
marty-5.1.1 other/marty/diagnostic/environment_variables.rb
marty-5.1.0 other/marty/diagnostic/environment_variables.rb
marty-3.1.0 other/marty/diagnostic/environment_variables.rb
marty-3.0.1 other/marty/diagnostic/environment_variables.rb
marty-4.0.0.rc2 other/marty/diagnostic/environment_variables.rb