Sha256: b93f3eb6fa597a909249fc40fef7d53f6742a9b2ab10570df9fe124155c14afd

Contents?: true

Size: 845 Bytes

Versions: 1

Compression:

Stored size: 845 Bytes

Contents

require 'yaml'

module HerokuResqueAutoScale
  module Config
    extend self

    CONFIG_FILE_NAME = 'scaler_config.yml'

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

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

    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.3.3 lib/heroku-resque-workers-scaler/config.rb