Sha256: 5a4772840ea00134bbf212f0567cd0c143342bfd6ca66d441b5305f04d934790

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

require 'yaml'

module HerokuResqueAutoScale
  module Config
    extend self

    CONFIG_FILE_NAME = 'scaler_config.yml'

    def thresholds
      @thresholds ||= config['thresholds']
    end

    def environments
      @environments ||= config['environments']
    end

    def worker_name
      @worker_name ||= config['worker_name']
    end

    private

    def config
      @config ||= YAML.load_file(config_route_path)
    end

    def config_route_path
      if defined?(Rails) && File.exists?(Rails.root.join("config/#{CONFIG_FILE_NAME}").to_s)
        Rails.root.join("config/#{CONFIG_FILE_NAME}").to_s
      else
        File.expand_path("../../../config/#{CONFIG_FILE_NAME}", __FILE__)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heroku-resque-workers-scaler-0.2.1 lib/heroku-resque-workers-scaler/config.rb