Class: Marty::Diagnostic::EnvironmentVariables
- Defined in:
- lib/marty/diagnostic/environment_variables.rb
Class Method Summary collapse
-
.apply_consistency(data) ⇒ Object
overwritten to only return inconsitent data.
- .env(filter = '') ⇒ Object
Methods inherited from Base
consistent?, diagnostic_fn, display, display_info_css, display_info_description, fatal?, get_difference, process_status_only
Methods included from Packer
#create_info, #error, #is_valid_info?, #pack, #process, #process_hash
Methods inherited from Request
op, params, request, request=, scope, ssl?
Class Method Details
.apply_consistency(data) ⇒ Object
overwritten to only return inconsitent data
31 32 33 34 35 36 37 38 39 |
# File 'lib/marty/diagnostic/environment_variables.rb', line 31 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 |
.env(filter = '') ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/marty/diagnostic/environment_variables.rb', line 6 def self.env filter = '' env = ENV.to_h.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 |