Sha256: 92535720977d466ff2bd738fbc74f1e242b6c3b2bed4a2109b1f6179ec5a0406

Contents?: true

Size: 724 Bytes

Versions: 6

Compression:

Stored size: 724 Bytes

Contents

module Vitals
  class Configuration
    attr_accessor :environment
    attr_accessor :facility
    attr_accessor :host
    attr_accessor :reporter
    attr_accessor :format

    def initialize
      @environment = fetch_development
      @facility = "default"
      @host = fetch_host
      @reporter = Vitals::Reporters::InmemReporter.new
      @format = Vitals::Formats::ProductionFormat
    end

    def build_format
      @format.new(
        environment: self.environment,
        facility: self.facility,
        host: self.host
      )
    end

    private

    def fetch_development
      ENV["RACK_ENV"] || ENV["NODE_ENV"] || "development"
    end

    def fetch_host
      Vitals::Utils.hostname
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vitals-0.8.0 lib/vitals/configuration.rb
vitals-0.7.0 lib/vitals/configuration.rb
vitals-0.6.0 lib/vitals/configuration.rb
vitals-0.5.0 lib/vitals/configuration.rb
vitals-0.4.0 lib/vitals/configuration.rb
vitals-0.3.0 lib/vitals/configuration.rb