Class: Bootprint::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/bootprint/configuration.rb

Constant Summary collapse

DEFAULT_ENV_PATTERNS =
[
  /\A(?:DATABASE|REDIS|RAILS|RACK|BUNDLE|SECRET_KEY_BASE|RAILS_MASTER_KEY)(?:_|\z)/,
  /_URL\z/,
  /_HOST\z/,
  /_PORT\z/
].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/bootprint/configuration.rb', line 17

def initialize
  @environment_patterns = DEFAULT_ENV_PATTERNS.dup
  @environment_names = []
  @ignored_environment_names = []
  @required_environment_names = []
  @optional_environment_names = []
  @privacy = :standard
  @slow_initializer_threshold_ms = 500.0
  @profile_boot = ENV["BOOTPRINT_PROFILE_BOOT"] == "1"
  @plugin_strict = false
  @redaction_patterns = %w[TOKEN SECRET PASSWORD PRIVATE_KEY AUTHORIZATION COOKIE]
  @redaction_safe_list = %w[checksum sha256 digest]
  @expected_platforms = []
end

Instance Attribute Details

#environment_namesObject

Returns the value of attribute environment_names.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def environment_names
  @environment_names
end

#environment_patternsObject

Returns the value of attribute environment_patterns.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def environment_patterns
  @environment_patterns
end

#expected_platformsObject

Returns the value of attribute expected_platforms.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def expected_platforms
  @expected_platforms
end

#ignored_environment_namesObject

Returns the value of attribute ignored_environment_names.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def ignored_environment_names
  @ignored_environment_names
end

#optional_environment_namesObject

Returns the value of attribute optional_environment_names.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def optional_environment_names
  @optional_environment_names
end

#plugin_strictObject

Returns the value of attribute plugin_strict.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def plugin_strict
  @plugin_strict
end

#privacyObject

Returns the value of attribute privacy.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def privacy
  @privacy
end

#profile_bootObject

Returns the value of attribute profile_boot.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def profile_boot
  @profile_boot
end

#redaction_patternsObject

Returns the value of attribute redaction_patterns.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def redaction_patterns
  @redaction_patterns
end

#redaction_safe_listObject

Returns the value of attribute redaction_safe_list.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def redaction_safe_list
  @redaction_safe_list
end

#required_environment_namesObject

Returns the value of attribute required_environment_names.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def required_environment_names
  @required_environment_names
end

#slow_initializer_threshold_msObject

Returns the value of attribute slow_initializer_threshold_ms.



12
13
14
# File 'lib/bootprint/configuration.rb', line 12

def slow_initializer_threshold_ms
  @slow_initializer_threshold_ms
end

Instance Method Details

#capture_environment?(name) ⇒ Boolean

Returns:

  • (Boolean)


32
33
34
35
36
# File 'lib/bootprint/configuration.rb', line 32

def capture_environment?(name)
  return false if ignored_environment_names.include?(name)

  environment_names.include?(name) || environment_patterns.any? { |pattern| pattern.match?(name) }
end