Sha256: ff640be7e64fe0206885498d798ae7ca8d8e8429114a436448a2438a9a4a76ec
Contents?: true
Size: 892 Bytes
Versions: 7
Compression:
Stored size: 892 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"] != "" 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
7 entries across 7 versions & 1 rubygems