Sha256: 7b0eef4f75b27ad7103c6418c7e404acfd744ab4dcdd81c25f3eb853c03da63e
Contents?: true
Size: 963 Bytes
Versions: 4
Compression:
Stored size: 963 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"] if enabled? && !key_present? warn("Missing PLAIN_APM_APP_KEY environment variable, plain_apm agent won't start.") end 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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
plain_apm-0.5.1 | lib/plain_apm/config.rb |
plain_apm-0.5.0 | lib/plain_apm/config.rb |
plain_apm-0.4.0 | lib/plain_apm/config.rb |
plain_apm-0.3.0 | lib/plain_apm/config.rb |