Sha256: b68e28dac4c0b2f611b985361fc8a8fd254dad61f5495595fd2a455018e314b8
Contents?: true
Size: 915 Bytes
Versions: 2
Compression:
Stored size: 915 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"] end private def enabled? ((production? && !interactive?) || force_enabled?) && !force_disabled? end def key_present? ENV["PLAIN_APM_APP_KEY"].to_s != "" end def production? (ENV["RAILS_ENV"] || ENV["RACK_ENV"] || ENV["APP_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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
plain_apm-0.10.2 | lib/plain_apm/config.rb |
plain_apm-0.10.0 | lib/plain_apm/config.rb |