class Metrician::Configuration

Constants

FileMissing

Public Class Methods

app_locations() click to toggle source
# File lib/metrician/configuration.rb, line 30
def self.app_locations
  [
    File.join(Dir.pwd, "config", "metrician.yaml"),
    File.join(Dir.pwd, "config", "metrician.yml"),
  ]
end
config_locations() click to toggle source
# File lib/metrician/configuration.rb, line 17
def self.config_locations
  [env_location, *app_locations, gem_location].compact
end
env_location() click to toggle source
# File lib/metrician/configuration.rb, line 21
def self.env_location
  path = ENV["METRICIAN_CONFIG"]
  if path && !File.exist?(path)
    # this should never raise unless a bad ENV setting has been set
    raise(FileMissing.new(path))
  end
  path
end
gem_location() click to toggle source
# File lib/metrician/configuration.rb, line 37
def self.gem_location
  File.expand_path("../../../metrician.defaults.yaml", __FILE__)
end
load() click to toggle source
# File lib/metrician/configuration.rb, line 7
def self.load
  reset_dependents

  config = {}
  config_locations.reverse.each do |location|
    config.deep_merge!(YAML.load_file(location)) if File.exist?(location)
  end
  config
end
reset_dependents() click to toggle source
# File lib/metrician/configuration.rb, line 41
def self.reset_dependents
  Metrician::Jobs.reset
  Metrician::Middleware.reset
end