Sha256: 5295863ef3cab7fbae18765eb93750244975b03939be93e8c43528430547be6d
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
require 'uuid' require 'logger' require 'caliper/version' require 'caliper/tracer' require 'caliper/rack' require 'caliper/route_inspector' require 'caliper/app_error' require 'caliper_api/http' if defined? ::Rails if ::Rails::VERSION::MAJOR >= 3 require 'caliper/railtie' else raise "Your Rails application is currently not supported with Caliper, get in touch we can make it so soon" end elsif !ENV["CALIPER_API_HOST"] #(might be in testing mode) raise "Your Ruby application is currently not supported with Caliper, get in touch, we can make it so soon" end module Caliper def self.logger unless @logger # if in Rails use Rails logger if defined? ::Rails @logger = ::Rails.logger else @logger = Logger.new(STDOUT) @logger.level = Logger::INFO end end @logger end def self.config if defined? ::Rails config_path = ::Rails.root env = ::Rails.env else config_path = File.new("./") env = "test" end begin @config ||= YAML.load_file("#{config_path.join("config", "caliper.yml")}")[::Rails.env].symbolize_keys Caliper.logger.error "No API Key set in caliper.yml" unless @config[:api_key] # set host @config[:api_host] = ENV["CALIPER_API_HOST"] || 'http://alpha.caliper.io/' @config rescue StandardError => e Caliper.logger.error "No caliper.yml config file could be found!" raise e end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
caliper-0.0.1 | lib/caliper.rb |