Class: ForgeOpsTracker::Configuration
- Inherits:
-
Object
- Object
- ForgeOpsTracker::Configuration
- Defined in:
- lib/forge_ops_tracker/configuration.rb
Instance Attribute Summary collapse
-
#app_root ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
-
#dsn ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
-
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments.
-
#environment ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
-
#logger ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
-
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
-
#queue_size ⇒ Object
Returns the value of attribute queue_size.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#release ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
-
#scrub_pii ⇒ Object
Returns the value of attribute scrub_pii.
-
#server_name ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
Instance Method Summary collapse
- #api_key ⇒ Object
- #enabled? ⇒ Boolean
-
#ingestion_uri ⇒ Object
The ingestion URL with credentials stripped out (they travel as the Authorization header instead, not embedded in the request URI).
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/forge_ops_tracker/configuration.rb', line 11 def initialize @dsn = ENV["FORGE_OPS_DSN"] @environment = ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "development" @release = ENV["FORGE_OPS_RELEASE"] @server_name = safe_hostname @enabled_environments = %w[production staging] @queue_size = 1000 @open_timeout = 2 @read_timeout = 2 @logger = nil # See PiiScrubber -- redacts likely-sensitive content (emails, # credit cards, known API key formats, anything under a # suspiciously-named key) before a payload ever leaves this # process. ForgeOps itself scrubs again on arrival regardless, so # this is a second, earlier layer, not the only one -- but "on" is # the only sane default. @scrub_pii = true end |
Instance Attribute Details
#app_root ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
8 9 10 |
# File 'lib/forge_ops_tracker/configuration.rb', line 8 def app_root @app_root end |
#dsn ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
8 9 10 |
# File 'lib/forge_ops_tracker/configuration.rb', line 8 def dsn @dsn end |
#enabled_environments ⇒ Object
Returns the value of attribute enabled_environments.
9 10 11 |
# File 'lib/forge_ops_tracker/configuration.rb', line 9 def enabled_environments @enabled_environments end |
#environment ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
8 9 10 |
# File 'lib/forge_ops_tracker/configuration.rb', line 8 def environment @environment end |
#logger ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
8 9 10 |
# File 'lib/forge_ops_tracker/configuration.rb', line 8 def logger @logger end |
#open_timeout ⇒ Object
Returns the value of attribute open_timeout.
9 10 11 |
# File 'lib/forge_ops_tracker/configuration.rb', line 9 def open_timeout @open_timeout end |
#queue_size ⇒ Object
Returns the value of attribute queue_size.
9 10 11 |
# File 'lib/forge_ops_tracker/configuration.rb', line 9 def queue_size @queue_size end |
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
9 10 11 |
# File 'lib/forge_ops_tracker/configuration.rb', line 9 def read_timeout @read_timeout end |
#release ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
8 9 10 |
# File 'lib/forge_ops_tracker/configuration.rb', line 8 def release @release end |
#scrub_pii ⇒ Object
Returns the value of attribute scrub_pii.
9 10 11 |
# File 'lib/forge_ops_tracker/configuration.rb', line 9 def scrub_pii @scrub_pii end |
#server_name ⇒ Object
A single Sentry-style DSN string carries both the ingestion URL and the project's api_key: "https://<api_key>@host/api/v1/events".
8 9 10 |
# File 'lib/forge_ops_tracker/configuration.rb', line 8 def server_name @server_name end |
Instance Method Details
#api_key ⇒ Object
30 31 32 |
# File 'lib/forge_ops_tracker/configuration.rb', line 30 def api_key parsed_dsn&.user end |
#enabled? ⇒ Boolean
45 46 47 |
# File 'lib/forge_ops_tracker/configuration.rb', line 45 def enabled? !blank?(dsn) && !blank?(api_key) && enabled_environments.map(&:to_s).include?(environment.to_s) end |
#ingestion_uri ⇒ Object
The ingestion URL with credentials stripped out (they travel as the Authorization header instead, not embedded in the request URI).
36 37 38 39 40 41 42 43 |
# File 'lib/forge_ops_tracker/configuration.rb', line 36 def ingestion_uri return nil unless parsed_dsn uri = parsed_dsn.dup uri.user = nil uri.password = nil uri end |