Sha256: 1ba4c06a425850028c933e95bd485bbf3ab3cf681c5920a09e7d3f37953c096b
Contents?: true
Size: 874 Bytes
Versions: 25
Compression:
Stored size: 874 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? || force_enabled?) && !force_disabled? end def key_present? ENV["PLAIN_APM_APP_KEY"] != "" end def production? (ENV["RAILS_ENV"] || ENV["RACK_ENV"]) == "production" 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
25 entries across 25 versions & 1 rubygems