Sha256: 33e131778f5dcf39e782686c688df3c7167200c2006645c50b39a90a9b52a028
Contents?: true
Size: 942 Bytes
Versions: 1
Compression:
Stored size: 942 Bytes
Contents
# frozen_string_literal: true module PlainApm class Config DEFAULT_EVENT_ENDPOINT = "https://ingest.plainapm.com/" attr_accessor :endpoint, :app_key, :enabled def initialize @enabled = enabled? && key_present? @endpoint = ENV["PLAIN_APM_ENDPOINT"] || DEFAULT_EVENT_ENDPOINT @app_key = ENV["PLAIN_APM_APP_KEY"] warn("PlainAPM agent enabled.") if enabled end private def enabled? ((production? && !interactive?) || force_enabled?) && !force_disabled? end def key_present? ENV["PLAIN_APM_APP_KEY"] != "" end def production? (ENV["RAILS_ENV"] || ENV["RACK_ENV"]) == "production" end def interactive? $stdout.tty? end # Allow to start in e.g. development. def force_enabled? ENV["PLAIN_APM_ENABLED"] == "1" end # Do not instrument def force_disabled? ENV["PLAIN_APM_DISABLED"] == "1" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
plain_apm-0.9.1 | lib/plain_apm/config.rb |